import java.util.*; import java.util.stream.Collectors; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); // 注意 hasNext 和 hasNextLine 的区别 while (in.hasNextLine()) { // 注意 while 处理多个 case String s = in.nextLine(); char[] chars = s.toCharArray(); Map<Character, Integer> count = new HashMap<>(); for (int i = 0; i < chars.length; i++) { Integer integer = count.get(chars[i]); if (integer == null) { integer = 1; count.put(chars[i], integer); continue; } count.put(chars[i], integer + 1); } List<Map.Entry<Character, Integer>> collect = count.entrySet().stream().collect( Collectors.toList()); Collections.sort(collect, new Comparator<Map.Entry<Character, Integer>>() { @Override public int compare(Map.Entry<Character, Integer> o1, Map.Entry<Character, Integer> o2) { return o1.getValue() - o2.getValue(); } }); int theCount = collect.get(0).getValue(); for (int j = 0; j < collect.size(); j++) { Map.Entry<Character, Integer> ce = collect.get(j); if (ce.getValue() == theCount) { s = s.replaceAll(Character.toString(ce.getKey()), ""); } } System.out.println(s); } } }