import java.util.Scanner;
import java.lang.String;
import java.util.Stack;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str=sc.nextLine();
        char[] c=str.toCharArray();
        Stack<Character> s=new Stack<Character>();
        for(int i=0;i<str.length();i++)
        {
            if(s.isEmpty()||s.peek()!=c[i])
            {
                s.push(c[i]);
            }else{
                s.pop();
            }
        }
        if(s.isEmpty())
        {
            System.out.println("0");
        }else {
            Stack<Character> s1=new Stack<Character>();
            while(!s.isEmpty())
            {
                s1.push(s.pop());
            }
            while(!s1.isEmpty())
            {
                System.out.print(s1.pop());
            }
        }
    }
}