#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;

    string mStack;

    for (int i = 0; i < s.size(); i++) {
        if (s.size() <= 1)break;

        if (mStack.empty()) {
            mStack += s[i];
        } else if (mStack.back() == s[i]) {
            mStack.pop_back();
        } else {
            mStack += s[i];
        }

    }

    cout<<((mStack.empty())?"0":mStack);


    return 0;


}
// 64 位输出请用 printf("%lld")