Skip to content

Instantly share code, notes, and snippets.

@nithyadurai87
Created April 2, 2018 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nithyadurai87/d7d964e7374b9f158f63643e2eb5b03e to your computer and use it in GitHub Desktop.
Save nithyadurai87/d7d964e7374b9f158f63643e2eb5b03e to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
wordcount={}
for line in sys.stdin:
line = line.strip()
word= line.split('\t')[0]
if word not in wordcount:
wordcount[word] = 1
else:
wordcount[word] += 1
for i in wordcount:
print i, wordcount[i]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment