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