We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
`n=int(input())
l=[input() for i in range(n)]
freq={}
order=[]
for i in l:
if i not in freq:
freq[i]=1
order.append(i)
else:
freq[i]+=1
print(len(order))
for i in order:
print(freq[i],end=' ')
`
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Word Order
You are viewing a single comment's thread. Return to all comments →
`n=int(input()) l=[input() for i in range(n)] freq={} order=[] for i in l: if i not in freq: freq[i]=1 order.append(i) else: freq[i]+=1 print(len(order)) for i in order: print(freq[i],end=' ')
`