Advertisement
Sabev

Odd Occurrences

Jan 14th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. line = input().lower()
  2. words = line.split(' ')
  3.  
  4. counts = {}
  5. for word in words:
  6.     if word in counts:
  7.         counts[word] += 1
  8.     else:
  9.         counts[word] = 1
  10. results = []
  11. for key, value in counts.items():
  12.     if value % 2 == 1:
  13.         results.append(key)
  14.  
  15.  
  16. print(", ".join(results))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement