Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import collections
  2. text = open('input.txt', 'r', encoding='utf8')
  3. dictWord = dict()
  4. numbers=dict()
  5. myText = text.readlines()
  6. for lines in myText:
  7. stroka = lines.split()
  8. for word in range(len(stroka)):
  9. word = stroka[word]
  10. countWord = stroka.count(word)
  11. dictWord[countWord] = word
  12. for val in dictWord:
  13. maxNumb = val
  14. maxKey = dictWord[val]
  15. if val > maxNumb:
  16. maxNumb = val
  17. if val== maxNumb and dictWord[val] > maxKey:
  18. maxNumb=val
  19. print(dictWord[maxNumb])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement