import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.next(); // 使用 LinkedHashSet 以保持插入顺序 Set<Character> uniqueChars = new LinkedHashSet<>(); // 将字符串s的每个字符添加到Set中以去除重复字符 for (char c : s.toCharArray()) { uniqueChars.add(c); } //就一个字符肯定没法弄 if(uniqueChars.size()==1) System.out.println(-1); else{ // 将Set转换为List来创建映射 List<Character> uniqueCharsList = new ArrayList<>(uniqueChars); // 创建映射 Map<Character, Character> mapping = new HashMap<>(); int size = uniqueCharsList.size(); for (int i = 0; i < size; i++) { // 将当前字符映射到下一个字符,最后一个字符映射到自己 char currentChar = uniqueCharsList.get(i); char nextChar = uniqueCharsList.get((i + 1) % size); // 使用取模来循环到第一个字符 mapping.put(currentChar, nextChar); } // 构建新的字符串t StringBuilder tBuilder = new StringBuilder(); for (char c : s.toCharArray()) { tBuilder.append(mapping.get(c)); } String t = tBuilder.toString(); // 输出新字符串 System.out.println(t); } in.close(); } }