while True:
try:
str_input = input()
new_list = list(set(str_input))
str_dict = {}
for c in new_list:
str_dict[c] = str_input.count(c)
res_list = sorted(sorted(str_dict.items(), key=lambda x : x[0]), key=lambda y: y[1], reverse=True)
result = ''
for i in res_list:
result += i[0]
print(result)
except:
break