Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open('input.txt')
- res = {}
- for i in f:
- s = i.split()
- for j in s:
- res[j] = res.setdefault(j, 0)+1
- r = list(res.items())
- r.sort(key=lambda x: (-x[1],x[0]))
- for i in r:
- print(i[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement