n = list(input()) flag = False for i in range(len(n) - 1): max_n = max(n[i+1:]) if n[i] < max_n: for j in reversed(range(i + 1, len(n))): if n[j] == max_n: n[i], n[j] = n[j], n[i] break break print("".join(n))