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