Advertisement
Guest User

Untitled

a guest
Jan 14th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. with open('input.txt', 'r') as fin:
  2.  
  3. lines = fin.readlines()
  4. words = []
  5. for i in range(len(lines)):
  6. lines[i] = lines[i].strip()
  7. words += (lines[i].split(' '))
  8. nums = dict()
  9. fin_nums = []
  10. for i in range(len(words)):
  11. nums[words[i]] = 0
  12. for i in range(len(words)):
  13. fin_nums.append(str(nums[words[i]]))
  14. nums[words[i]] += 1
  15. print(*fin_nums)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement