N = list(input()) A = ["".join(N)] for i in range(len(N)-1): for j in range(i+1,len(N)): N[i],N[j] = N[j],N[i] a = "".join(N) A.append(a) N[i],N[j] = N[j],N[i] A = sorted(A,reverse=True) print(A[0])