Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open('input.txt', 'r') as fin:
- lines = fin.readlines()
- words = []
- for i in range(len(lines)):
- lines[i] = lines[i].strip()
- words += (lines[i].split(' '))
- nums = dict()
- fin_nums = []
- for i in range(len(words)):
- nums[words[i]] = 0
- for i in range(len(words)):
- fin_nums.append(str(nums[words[i]]))
- nums[words[i]] += 1
- print(*fin_nums)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement