SHARE
TWEET

Untitled

a guest Jan 14th, 2020 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top