import java.io.*; import java.util.*; class Main { public static void out (Object o) { System.out.println(o); } public static void solve (int n) { char[] c = (n + "").toCharArray(); for (int i = 0; i < c.length - 1; i++) { int d = c[i] - '0'; int max = d , maxI = -1; for (int j = c.length - 1; j > i; j--) { int e = c[j] - '0'; if (max < e) { max = e; maxI = j; } } if (maxI != -1) { char tmp = c[i]; c[i] = c[maxI]; c[maxI] = tmp; break; } } for (char d : c) System.out.print(d); out(""); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); solve(n); } }