You are viewing a single comment's thread. Return to all comments →
Python Counter
from collections import Counter def word_count(words): return Counter(words) def print_word_counts(d): print(len(d)) print(' '.join(map(str,list(d.values())))) if __name__ == "__main__": n = int(input()) words = [input() for _ in range(n)] word_counts = word_count(words) print_word_counts(word_counts)
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 →
Python Counter