• + 0 comments
    from collections import Counter
    
    
    if __name__ == '__main__':
        s = input()
        c = Counter(s)
        sort_val = sorted(c.values(), reverse=True) #nos. sorted in ascending order
        sort_counter = dict(sorted(c.items())) #sorted the counter
        i = 0
        while(i<3):
            for k,v in sort_counter.items():
                if v==sort_val[i]:
                    print(k +" "+ str(v))
                    sort_counter.pop(k)
                    i+=1
                    break