import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); char[] arr = sc.next().toCharArray(); int max = 0; int maxIdx = 0; for (int i = 0; i < arr.length; i++) { if (max <= arr[i] - '0') { max = arr[i] - '0'; maxIdx = i; } } for (int i = 0; i < maxIdx; i++) { if (arr[i] - '0' < max) { char tmp = arr[i]; arr[i] = arr[maxIdx]; arr[maxIdx] = tmp; break; } } System.out.println(arr); } }