n = list(map(int, list(input()))) n_max = max(n) n_max_index = len(n) - n[::-1].index(n_max) - 1 for i in range(n_max_index): if n[i] == n_max: continue n[i], n[n_max_index] = n[n_max_index], n[i] break for i in n: print(i, end='') print()