N = list(input()) ans = int("".join(N)) for i in range(len(N)): for j in range(i): N2 = N[:] N2[i],N2[j] = N2[j],N2[i] ans = max(ans,int("".join(N2))) print(ans)