import itertools,copy N = [int(i) for i in list(input())] C = itertools.combinations(range(len(N)),2) ans = 0 cur = 0 for n in N: ans *= 10 ans += n for a,b in C: NewN = copy.deepcopy(N) NewN[a],NewN[b] = NewN[b],NewN[a] cur = 0 for n in NewN: cur *= 10 cur += n ans = max(cur,ans) print(ans)