Skip to content

Instantly share code, notes, and snippets.

@abhinavkorpal
Created April 7, 2017 09:16
Show Gist options
  • Save abhinavkorpal/c1ce436234557d07be9b3f21aa39f37b to your computer and use it in GitHub Desktop.
Save abhinavkorpal/c1ce436234557d07be9b3f21aa39f37b to your computer and use it in GitHub Desktop.
Word Order
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment