You are viewing a single comment's thread. Return to all comments →
As a one-liner (with one import: from collections import Counter):
from collections import Counter
print('\n'.join(f'{k} {v}' for k, v in Counter(sorted(input())).most_common(3)))
Seems like cookies are disabled on this browser, please enable them to open this website
Company Logo
You are viewing a single comment's thread. Return to all comments →
As a one-liner (with one import:
from collections import Counter
):