Advertisement
Guest User

Untitled

a guest
Mar 1st, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. def check(word_first):
  3. global word_second
  4. global data
  5. if all(symbol in word_second for symbol in word_first):
  6. data.remove(word_first)
  7. return word_first.lower()
  8.  
  9.  
  10. file_input = open("input.txt", "r")
  11. file_output = open("output.txt", "w")
  12. next(file_input)
  13. data = [i.strip().lower() for i in file_input]
  14. for i in range(len(data)):
  15. word_second = data[0].lower()
  16. print(*[data[0]] + list(filter(check, data[1:])), file=file_output)
  17. data.pop(0)
  18. if not data:
  19. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement