N,R,M=input(),range,max L=len(N) print(M([N]+[M([N[:i]+N[j]+N[i+1:j]+N[i]+N[j+1:]for j in R(i+1,L)])for i in R(L-1)]))