You are viewing a single comment's thread. Return to all comments →
n = int(input()) words = [input() for i in range(n)] result = {} for word in words: if word not in result: result[word] = 1 elif word in result: result[word] += 1 print(len(result)) for i in result.values(): print(i, end = ' ')
n = int(input()) words = [input() for i in range(n)]
result = {}
for word in words: if word not in result: result[word] = 1 elif word in result: result[word] += 1
print(len(result)) for i in result.values(): print(i, end = ' ')
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 →
without any modules
print(len(result)) for i in result.values(): print(i, end = ' ')