while 1: x='' for y in input():x+=max(x+y) print(x)