-
-
Save seungjin/59ad2ffb5fa3447d2d53fcfcb61ae707 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python2 | |
import sys | |
from operator import itemgetter | |
from collections import defaultdict | |
def main(): | |
count = defaultdict(int) | |
for line in sys.stdin: | |
for word in line.split(): | |
count[word] += 1 | |
for e, v in sorted(count.items(), key=itemgetter(1), reverse=True): | |
print e, " ", v | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment