word order hackerrank solution
from collections import Counter
n =int(input())
L = []
for i in range(n):
L.append(input())
c=Counter(L)
print(len(c))
print(*c.values())
for last line we can use below code as well
for i in c.values():
print(i ,end=" ")
Comments
Post a Comment