for(;r=readline(c="");print())for each(x in r)x>c&&putstr(c=x)