import java.util.*;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String res_str = "";
// 注意 hasNext 和 hasNextLine 的区别
while (in.hasNextLine()) { // 注意 while 处理多个 case
// 进行两两消除
String str = in.nextLine();
Stack<Character> stack = new Stack<>();
// 依次入栈
for(char c : str.toCharArray()){
if(stack.isEmpty()){
stack.push(c);
}else{
// 如果跟栈顶元素一样,则将栈顶元素抛出
if(stack.peek() == c){
stack.pop();
}else{
stack.push(c);
}
}
}
while(!stack.isEmpty()){
res_str = stack.pop() + res_str;
}
if(res_str.equals("")){
System.out.println(0);
}else{
System.out.println(res_str);
}
}
}
}