import java.util.Scanner; public class Main { static boolean memo[]; static int ans, min; public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(); char[] n = sc.next().toCharArray(); char tmp; int idx; for (int i = 0; i < n.length - 1; i++) { tmp = '0'; idx = 0; for (int j = n.length - 1; j > i; j--) { if (n[i] < n[j]) { if (tmp < n[j]) { tmp = n[j]; idx = j; } } } if (tmp != '0') { n[idx] = n[i]; n[i] = tmp; break; } } for (int i = 0; i < n.length; i++) { sb.append(n[i]); } System.out.println(sb); } }