while True:
try:
zifuchuan = input()
list1 = sorted(set(zifuchuan)) #向将输入的字符串去重并根据ASC11升序排序,为后面的字母数相同的升序排序做条件
except:
break
try:
zifuchuan = input()
list1 = sorted(set(zifuchuan)) #向将输入的字符串去重并根据ASC11升序排序,为后面的字母数相同的升序排序做条件
list2 = sorted(list1,key=lambda x:zifuchuan.count(x),reverse=True) #对list1中的字母按照该字符在输入中出现的次数进行降序排序,
#由于list1已经对字符进行升序排序了,所以数字相同时自动会按照升序排序
print(''.join(list2)) 将list2中经过排序的字符连接except:
break