Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import collections
- text = open('input.txt', 'r', encoding='utf8')
- dictWord = dict()
- numbers=dict()
- myText = text.readlines()
- for lines in myText:
- stroka = lines.split()
- for word in range(len(stroka)):
- word = stroka[word]
- countWord = stroka.count(word)
- dictWord[countWord] = word
- for val in dictWord:
- maxNumb = val
- maxKey = dictWord[val]
- if val > maxNumb:
- maxNumb = val
- if val== maxNumb and dictWord[val] > maxKey:
- maxNumb=val
- print(dictWord[maxNumb])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement