while 1: m=o='' for c in raw_input():m=max(c,m);o+=m print o