You are viewing a single comment's thread. Return to all comments →
if __name__ == '__main__': s = input() ch = {} for i in s: ch[i] = ch.get(i, 0) + 1 sorted_by_keys = dict(sorted(ch.items())) sorted_by_values = dict(sorted(sorted_by_keys.items(), key=lambda item: item[1], reverse=True)[:3]) for key, value in sorted_by_values.items(): print(key, value)
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 →