Advertisement
repente

Untitled

Nov 10th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. user = input()
  2.  
  3. words01 = user.split(" ")
  4.  
  5. words02 = set(words01)
  6.  
  7. temp_result = []
  8. for word in words02:
  9. temp_result.append([word, words01.count(word)])
  10.  
  11. popular_words = sorted(temp_result, key = lambda x : x[1], reverse=True)
  12.  
  13. result = []
  14. count = popular_words[0][1]
  15. for word in popular_words:
  16. if count == word[1]:
  17. result.append(word[0])
  18. result_sort = sorted(result)
  19. print(result_sort[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement