from collections import defaultdict s = input() d = defaultdict(int) for ch in s: d[ch] += 1 dd = dict() for k, v in d.items(): # print(k, v) if d[k] not in dd: dd[v] = k else: dd[v] = dd[v] + k for k in sorted(dd, reverse=True): print("".join(sorted(dd[k])), end="")