• + 0 comments
    1. from collections import Counter
    2. if name == 'main':
    3. s = input()
    4. s = list(s)
    5. store = []
    6. counter = Counter(s)
    7. sorted_counter = dict(sorted(counter.items()))
    8. for i in range(3):
    9. max_key = max(sorted_counter,key=sorted_counter.get)
    10. store.append([max_key,str(sorted_counter[max_key])])
    11. sorted_counter.pop(max_key)
    12. [print(" ".join(i)) for i in store]