N = input().rstrip() MAX = N for i in range(0, len(N)): M = N[i] for j in range(i + 1, len(N)): if M <= N[j]: M = N[j] S = list(N) S[i], S[j] = S[j], S[i] MAX = max(MAX, "".join(S)) print(MAX)