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.
fromcollectionsimportCounterif__name__=='__main__':n=int(input())# Solution 1# word_occ = {}# for _ in range(n):# word = str(input())# if word not in word_occ:# word_occ[word] = 1# else:# word_occ[word] += 1# print(len(word_occ.keys()))# print(*word_occ.values())# Soultion 2words=[input()for_inrange(n)]word_occ=Counter(words)print(len(word_occ.keys()))print(*word_occ.values())
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 →