Skip to content

Instantly share code, notes, and snippets.

@JustinAzoff
Created November 8, 2016 22:30
Show Gist options
  • Save JustinAzoff/57e9f2aba7aac6717dd00e91c2046444 to your computer and use it in GitHub Desktop.
Save JustinAzoff/57e9f2aba7aac6717dd00e91c2046444 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python2
import sys
from collections import defaultdict
c = defaultdict(int)
for line in sys.stdin:
c[line] += 1
top = sorted(c.items(), key=lambda (k,v): v)
for k, v in top:
print v, k,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment