'''
解题思路:
字典统计字符直方图,字典的Dict.items()方法返回元组数组,可用于字典的key和value排序
'''
while 1:
    try:
        S = input().strip()
        #print(S)

        Dict = dict()
        for s in S:
            if s not in Dict:
                Dict[s] = 1
            else:
                Dict[s] += 1
        #print(Dict)
        #print(Dict.items())

        D1 = sorted(Dict.items(),key=lambda x:x[0])
        D2 = sorted(D1,key=lambda x:x[1],reverse=1)

        #print('D1=',D1)
        #print('D2=',D2)
        T = ''
        for i in range(len(D2)):
            T = T+D2[i][0]
        print(T)

    except:
        break