import java.io.BufferedReader; import java.io.InputStreamReader; public class No039 { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader( System.in)); String S = br.readLine(); int N = Integer.parseInt(S); int max = N; int Slength = S.length(); char[] c; char tmp; int newN = 0; for (int j = 0; j < Slength; j++) { for (int i = j + 1; i < Slength; i++) { c = S.toCharArray(); tmp = c[i]; c[i] = c[j]; c[j] = tmp; newN = Integer.parseInt(String.copyValueOf(c)); max = Math.max(max, newN); } } System.out.println(max); } catch (Exception e) { System.err.println("Error:" + e.getMessage()); } } }