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