#include <bits/stdc++.h>
using namespace std;
int main()
{
    stack<char> st;
    string s;
    cin>>s;
    for (auto& c: s) {
        bool flag = true;
        while (!st.empty() && st.top() == c) {
            st.pop();
            flag = false;
        }
        if (flag) st.push(c);
    }
    s = "";
    while (!st.empty()) {
        s = st.top() + s; st.pop();
    }
    if (s.size() > 0) cout<<s<<endl;
    else cout<<0<<endl;
    return 0;
}