s = input() l = [] for i in set(s): l.append((i,s.count(i))) l.sort(key=lambda x:(-x[1],x[0])) for i in l: print(i[0],end="")