Created
April 7, 2017 09:16
-
-
Save abhinavkorpal/c1ce436234557d07be9b3f21aa39f37b to your computer and use it in GitHub Desktop.
Word Order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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