public static void main(String[] args) {
//Character是字符类型
Stack<Character> stack = new Stack();
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
for(int i = 0; i<str.length();i++){
//如果是空栈,则直接入栈
if(stack.empty()){
stack.push(str.charAt(i));
//如果相等,则出栈
}else if(str.charAt(i) == stack.peek()){
stack.pop();
}else {
//如果不空也不相等,直接入栈
stack.push(str.charAt(i));
}
}
//如果最后是空
if (stack.empty())
System.out.println(0);
String s = "";
while(!stack.empty()){
s = s + stack.pop();
}
//因为栈顶元素在前面,得反过来
for (int i = s.length()-1; i >= 0; i--) {
System.out.print(s.charAt(i));
}
}