d='' for c in input()+'{':print(end=min(c,d));d=max(c,d)