#include <iostream>
#include<stack>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
stack<char>sta;
string t;
cin>>t;
for(char i:t){
if(!sta.empty()){
if(sta.top()!=i)sta.push(i);
else sta.pop();
}
else sta.push(i);
}
vector<char>res;
if(sta.empty())cout<<0<<endl;
else {
while(!sta.empty()){
res.push_back(sta.top());
sta.pop();
}
}
reverse(res.begin(),res.end());
for(char i:res){
cout<<i;
}
return 0;
}

京公网安备 11010502036488号