l = list(input()) l = list(l) for i in range(len(l)): mx = len(l) - list(reversed(l[i:])).index(max(l[i:])) - 1 if mx > i: if int(l[mx]) > int(l[i]): l[mx], l[i] = l[i], l[mx] break print(''.join(l))