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