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