filter.py (324B)
1 #!/usr/bin/python3 2 3 import sys 4 5 ws = set() 6 7 while True: 8 l = sys.stdin.readline() 9 if not l: 10 break 11 l = l.rstrip() 12 f = l.split(' ') 13 ok = True 14 for w in ws: 15 if f[0].endswith(w) or w.endswith(f[0]): 16 ok = False 17 break 18 if ok: 19 print(l) 20 ws.add(f[0]) 21