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