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