import java.util.Scanner; public class Main_yukicoder39 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] n = sc.next().toCharArray(); int max = Integer.parseInt(new String(n)); for (int i = 0; i < n.length; i++) { for (int j = i + 1; j < n.length; j++) { char tmp = n[i]; n[i] = n[j]; n[j] = tmp; max = Math.max(max, Integer.parseInt(new String(n))); tmp = n[i]; n[i] = n[j]; n[j] = tmp; } } System.out.println(max); sc.close(); } }