while True:
    try:
        a = input()
        b = dict.fromkeys(sorted(set(a)))
        for i in range(len(b)):
            m = list(b.keys())[i]
            b[m] = a.count(m)
        result = dict(sorted(b.items(),key=lambda x:x[1],reverse=True))
        print(''.join(result.keys()))
    except:
        break