while 1: t='' for s in input():t+=max(s+t) print(t)