=====Problem Statement=====
A newly opened multinational brand has decided to base their company logo on the three most common characters in the company name. They are now trying out various combinations of company names and logos based on this condition. Given a string s, which is the company name in lowercase letters, your task is to find the top three most common characters in the string.
Print the three most common characters along with their occurrence count.
Sort in descending order of occurrence count.
If the occurrence count is the same, sort the characters in alphabetical order.
For example, according to the conditions described above, GOOGLE would have it's logo with the letters G, O, E. 
=====Input Format=====
A single line of input containing the string S.
=====Constraints=====
3≤len(S)≤10^4
#!/bin/python3

import sys
from collections import Counter

def __starting_point():
    s = input().strip()
    best = Counter(s)
    sortit = sorted(list(best.items()), key = lambda x: (-x[1], x[0]))[:3]
        
    print(("\n".join(x[0]+" "+str(x[1]) for x in sortit)))

__starting_point()
#!/bin/python3

import sys
from collections import Counter

def __starting_point():
    s = input().strip()
    best = Counter(s)
    sortit = sorted(list(best.items()), key = lambda x: (-x[1], x[0]))[:3]
        
    print(("\n".join(x[0]+" "+str(x[1]) for x in sortit)))

__starting_point()