You are viewing a single comment's thread. Return to all comments →
Here's my solution using Counter() from collections:
from collections import Counter n = int(raw_input()) words = [raw_input().strip() for _ in range(n)] counts = Counter(words) print len(counts) for word in words: derp = counts.pop(word, None) if derp == None: continue else: print derp, # comma stops print from ending with newline
Seems like cookies are disabled on this browser, please enable them to open this website
Word Order
You are viewing a single comment's thread. Return to all comments →
Here's my solution using Counter() from collections: