Created
April 8, 2012 00:09
-
-
Save daltonmatos/2333049 to your computer and use it in GitHub Desktop.
Count words
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
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