N = list(input()) max = int("".join(N)) for i in range(len(N)): for j in range(len(N)): if i == j: continue N[i], N[j] = N[j], N[i] if max < int("".join(N)): max = int("".join(N)) N[j], N[i] = N[i], N[j] print(max)