while 1: r='' for c in input():r+=max(r+c) print(r)