You are viewing a single comment's thread. Return to all comments →
from collections import Counter
def word_order(words): word_counts = Counter(words)
values = ' '.join(str(value) for value in word_counts.values()) dict_len = len(word_counts) return dict_len, values
if name == 'main': n = int(input()) words = [input() for _ in range(n)] result = word_order(words) print(result[0]) print(result[1])
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 →
from collections import Counter
def word_order(words): word_counts = Counter(words)
if name == 'main': n = int(input()) words = [input() for _ in range(n)] result = word_order(words) print(result[0]) print(result[1])