def check(first, second): fl=list(first) sl=list(second) fl.sort() sl.sort() tl=sl[:] for x in tl: if x in fl: fl.remove(x) sl.remove(x) if fl==[]: if len(sl)<2]: return True return False if len(fl)==1: if len(sl)<2]: return True return Falsereturn False return False f=open('input.txt','r') al=f.readlines() f.close() word=al[1] for w in al[2:]: if check(word,w)..