while 1: a="" for c in input():a+=max(a+c) print(a)