while 1:a=raw_input();print"".join(map(str,sorted(map(a.count,set(a)))[-2::-1]))