#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <stack>
using namespace std;
typedef long long LL;
#define FAST ios::sync_with_stdio(false);
const int MaxN = 105;
stack<char > que;
stack<char> st;
int main()
{
	string s;
	cin >> s;
	for(int i = 0 ; i < s.length(); i++)
	{
		if(s[i] == 'B' && !que.empty())que.pop();
		if(s[i] == '1' || s[i] == '0')que.push(s[i]);
		}
	while(!que.empty())
	{
		char n = que.top();
		st.push(n);
		que.pop();
		}
	while(!st.empty())
	{
		char m = st.top();
		cout << m;
		st.pop();
		}
	cout << endl;
	return 0;
	}