pacho_the_python

odd_occurrences

Mar 14th, 2022
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. words_input = input().split(" ")
  2.  
  3. words = []                                               # words = list(map(lambda x: x.lower() words_input))
  4. for word in words_input:
  5.     words.append(word.lower())
  6.  
  7. words_counter = {}
  8. for i in words:
  9.     if i not in words_counter:
  10.         words_counter[i] = 1
  11.     else:
  12.         words_counter[i] += 1
  13.  
  14. odd_words = []
  15. for j in words_counter.keys():
  16.     if words_counter[j] % 2 != 0:
  17.         odd_words.append(j)
  18.  
  19. print(" ".join(odd_words))
  20.  
Advertisement
Add Comment
Please, Sign In to add comment