import java.util.Scanner; import java.util.Arrays; public class Main { public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); String x = stdIn.next(); char c[] = x.toCharArray(); char copy[] = new char[x.length()]; Arrays.sort(c); for(int i = 0; i < x.length(); i++){ copy[i] = c[x.length() - i - 1]; } boolean flag = false; for(int i = 2; i < x.length(); i++){ if(copy[1] != copy[i]){ int tmp = copy[1]; copy[1] = copy[i]; copy[i] = (char)tmp; flag = true; break; } } if(flag){ System.out.println(copy); }else{ System.out.println(-1); } } }