Create a gist now

Instantly share code, notes, and snippets.

Count words
import sys
users = {}
for line in sys.stdin:
username = line.strip('\n')
if username not in users:
users[username] = 1
else:
users[username] += 1
for k, v in users.iteritems():
print "{0} {1}".format(k, v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment