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

京公网安备 11010502036488号