import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); // 注意 hasNext 和 hasNextLine 的区别 String s = in.next(); System.out.println(slove(s)); } public static StringBuffer slove(String s) { StringBuffer sb = new StringBuffer(s); char[] chr = s.toCharArray(); for (int j = 1; j <= chr.length - 1; j++) { for (int i = 0; i < chr.length - j; i++) { if (chr[i] == chr[chr.length - j]) { sb = sb.delete(chr.length - j, chr.length - j + 1); break; } } } return sb; } }