from operator import itemgetter def main(): N = input() rev = sorted(enumerate(N), reverse=True, key=itemgetter(0, 1)) a = b = 0 for i in range(len(N)): if N[i] != rev[i][1]: a, b = i, rev[i][0] break ans = list(N) ans[a], ans[b] = ans[b], ans[a] print(''.join(ans)) main()