import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        char[] chrs = scan.nextLine().toCharArray();
        StringBuffer ans = new StringBuffer("");
        LinkedList<Character> ll = new LinkedList<>();
        for (char chr : chrs) {
            if (!ll.isEmpty() && ll.peekLast() == chr) {
                ll.removeLast();
            } else {
                ll.add(chr);
            }
        }
        while (!ll.isEmpty()) {
            ans.append(ll.poll());
        }
        System.out.println("".equals(new String(ans)) ? 0 : ans);
    }
}