#include <iostream>
#include <string>
using namespace std;
int main() {
	string str;
	cin >> str;//输入给定的字符串
	string s;
	for (int i = 0; i < str.size(); i++) {
		if (s.empty()) {
			s.push_back(str[i]);//将字符串插入s数组中
		}
		else {
			if (s.back() == str[i]) //倒序比较
				s.pop_back();
			else if (s.back() != str[i])
				s.push_back(str[i]);
		}
	}
	if (s.empty()) {
		cout << '0' << endl;
		return 0;
	}
	cout << s << endl;
	return 0;
}