char s[9];i,k;main(j){for(gets(s);k==i&&s[k=j=i];k=s[k]-s[i]?s[i]^=s[k]^=s[i]^=s[k]:++i)for(;s[++j]>=s[k]?k=j:s[j];);i=!puts(s);}