def to_int(ds): res = 0 for d in ds: res *= 10 res += d return res def swap(ds, i, j): ds2 = ds[:] x = ds2[i] y = ds2[j] ds2[i] = y ds2[j] = x return ds2 ds = [int(x) for x in raw_input()] L = len(ds) ans = max([to_int(swap(ds, i, j)) for i in range(L) for j in range(L)]) print(ans)