You are viewing a single comment's thread. Return to all comments →
def count(s): s = sorted(s) count_letters = {} for char in s: count_letters[char] = count_letters.get(char, 0)+1 arr = sorted(count_letters.items(), key=lambda x: x[1] , reverse=True)
for i in range(3): print(arr[i][0], arr[i][1])
if name == 'main': count(input())
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 →
def count(s): s = sorted(s) count_letters = {} for char in s: count_letters[char] = count_letters.get(char, 0)+1 arr = sorted(count_letters.items(), key=lambda x: x[1] , reverse=True)
if name == 'main': count(input())