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.
# Enter your code here. Read input from STDIN. Print output to STDOUTfromcollectionsimportOrderedDictn=int(input())ordered_input_dict=OrderedDict()foriinrange(n):val=input()ifvalnotinordered_input_dict.keys():ordered_input_dict[val]=1else:ordered_input_dict[val]+=1print(len(ordered_input_dict))# print(' '.join(str(val) for val in ordered_input_dict.values()))print(' '.join(map(str,ordered_input_dict.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 →