from itertools import combinations s=list(input()) n=len(s) ans='' for i in s: ans+=str(i) ans=int(ans) for com in combinations(range(n),2): x,y=com s[x],s[y]=s[y],s[x] tmp='' for i in s: tmp+=str(i) tmp=int(tmp) ans=max(ans,tmp) s[x],s[y]=s[y],s[x] print(ans)