Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. from _future_ import print_function
  2. import sys
  3. current_word = None
  4. word_count = 0
  5. for line in sys.stdin:
  6. word, counts = line.split("\t".1)
  7. counts = int(counts)
  8. if word == current_word:
  9. word_count += cpunts
  10. else:
  11. if current_word:
  12. print(current_word, word_count, sep="\t")
  13. current_world = word
  14. word_count = counts
  15.  
  16. if current_word:
  17. print(current_word,word_count, sep="\t")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement