import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import itertools N = [str(x - ord('0')) for x in read().rstrip()] to_int = lambda x: int(''.join(x)) cand = [to_int(N)] for i,j in itertools.combinations(range(len(N)),2): N[i],N[j] = N[j],N[i] cand.append(to_int(N)) N[i],N[j] = N[j],N[i] answer = max(cand) print(answer)