#include <iostream>
#include <string>
#include <stack>
using namespace std;
int main() {
string s;
cin >> s;
stack<char> st;
for (char& i : s) {
if (!st.empty() && st.top() == i) {
st.pop();
} else {
st.push(i);
}
}
if (st.empty())
cout << 0;
else
{
stack<char> st2;
while (!st.empty())
{
st2.push(st.top());
st.pop();
}
while (!st2.empty())
{
cout << st2.top();
st2.pop();
}
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号