import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String str = in.nextLine(); int n = str.length(); BitSet bitset = new BitSet(); for (int i = 0; i < n; i++) { // 搜索过的字符不再搜索 if (bitset.get(str.charAt(i))) { continue; } int j = n - 1; // 反向搜索 直到遇到相同的字符 或者 搜索到当前第i个字符为止 for (; j > i && str.charAt(j) != str.charAt(i); j--) {} // 如果 j == i 则表明反向搜索当前字符了 即当前字符只出现了一次 if (j == i) { System.out.print(str.charAt(i)); return; } bitset.set(str.charAt(i)); } System.out.println(-1); } }