N=input() ans=int(N) for i in range(len(N)): for j in range(i+1,len(N)): x=int(N[:i]+N[j]+N[i+1:j]+N[i]+N[j+1:]) ans=max(ans,x) print(ans)