#include <iostream>
#include <stack>
using namespace std;

int main() {
    string s;
    getline(cin, s);
    stack<char> q;
    
    for (int i = 0; i < s.size(); i++) {
        if (q.empty()) {
            q.push(s[i]);
        }else if (q.top() == s[i]){
//             printf("%c ", q.top());
            q.pop(); 
        }else {
            q.push(s[i]);
        }
//         printf("%c ", q.top());
    }
    string res;
    int k = q.size();
    int size = q.size();
    if (q.size() == 0) 
        printf("0");
    else {
        while (!q.empty()) {
            res += q.top();
            q.pop();
        }
        for (int i = 0; i < res.size(); i++) {
            printf("%c",res[res.size()-i-1]);
        }
    }
        
    
    
    return 0;
}