from itertools import combinations N = list(input()) res = 0 for v in combinations(range(len(N)), 2): a = N.copy() a[v[0]], a[v[1]] = a[v[1]], a[v[0]] res = max(res, int(''.join(a))) print(res)