while True:
try:
str_input = input()
new_list = list(set(str_input))
print(''.join(sorted(new_list, key=lambda x: str_input.count(x) * 1000 - ord(x),reverse=True)))
except:
break
while True:
try:
str_input = input()
new_list = list(set(str_input))
print(''.join(sorted(new_list, key=lambda x: str_input.count(x) * 1000 - ord(x),reverse=True)))
except:
break