#include <iostream>
#include <algorithm>
#include <stack>

using namespace std;

int main() {
    string a;
    stack<char> stk;
    cin >> a;
    for (int i = 0; i < a.size(); i++) {
        if (stk.empty()) {
            stk.push(a[i]);
        }
        else {
            if (stk.top() == a[i]) {
                stk.pop();
            }
            else {
                stk.push(a[i]);
            }
        }
    }
    if (stk.empty())
        cout << 0 << endl;
    else {
        int n = stk.size();
        char b[n];
        for (int i = n-1; i >= 0; i--) {
            b[i] = stk.top();
            stk.pop();
        }
        for (int i = 0; i < n; i++) {
            cout << b[i];
        }
    }
    return 1;
}