SHARE
TWEET

Untitled

a guest Aug 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sentence = input().split()
  2. d = dict()
  3. max_count = 0
  4. for word in sentence:
  5.     if word in d:
  6.         d[word] += 1
  7.     else:
  8.         d[word] = 1
  9. for word in d:
  10.     if d[word] > max_count:
  11.         max_count = d[word]
  12.         max_word = word
  13.     elif d[word] == max_count:
  14.         max_word = min(word, max_word)
  15. print(max_word)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top