import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.next(); scan.close(); String []ary = s.split(""); int max = Integer.parseInt(s); for(int i = 0; i < ary.length; i++) { for(int j = i + 1; j < ary.length; j++) { int t = swap(ary, i, j); if(max < t) { max = t; } } } System.out.println(max); } public static int swap(String []A, int i, int j) { String []B = new String[A.length]; for(int k = 0; k < A.length; k++) { B[k] = A[k]; } String t = B[j]; B[j] = B[i]; B[i] = t; int a = Integer.parseInt(String.join("", B)); return a; } }