#include <bits/stdc++.h>
using namespace std;

string str;
stack<char> s;

int main(){
    cin>>str;
    for(auto x : str){
        if(s.size()&&s.top()==x) s.pop();
        else s.push(x);
    }
    str = "";
    while(s.size()) {
        str.push_back(s.top());
        s.pop();
    }
    if(str.size()==0) return cout<<0,0;
    for(int i = str.size()-1;i>=0;i--) cout<<str[i];

    return 0;
}

#牛客春招刷题训练营#https://www.nowcoder.com/discuss/727521113110073344