n = [*input()] L = len(n) s = [] for i in range(L): for j in range(i+1,L): n[i],n[j] = n[j],n[i] s.append(int("".join(n))) n[i],n[j] = n[j],n[i] print(max(s))