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