Advertisement
snowden_web

Untitled

May 11th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. text = input().split()
  2. d = dict()  #skolko raz vstretili
  3. for word in text:
  4.     if word not in d:
  5.         d[word] = 1
  6.     else:
  7.         d[word] += 1
  8. max_c = -1
  9. for key in d:
  10.     if d[key] > max_c:
  11.         max_c = d[key]
  12.         max_w = key
  13.     elif d[key] == max_c:
  14.         if key < max_w:
  15.             max_w = key
  16. print(max_w)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement