import sys str=input() dic=dict() set=set(str) a=list(set) a.sort() for i in set: dic[i]=str.count(i) for j in range(max(dic.values()),-1,-1): for i in a: if dic[i]==j: print(i,end='')