s=gets;i=-1;s.chars.any?{|c|t=s[i+=1,$$].max;c!=t&&(s[i],s[s.rindex t]=t,c)};$><