#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cstdio>
//#include<string>
//#include<sstream>
using namespace std;
int main()
{
	char a[20],b[20];
	int n,i,k=0;
	scanf("%s",&a);
	n=strlen(a);
	for(i=0;i<n;i++)
	{
		if(a[i]=='B')
		{
			if(k!=0)
				k--;
		}
		else if(a[i]=='0'||a[i]=='1')
		{
			b[19-k++]=a[i];
		}
	}
	for(i=19;(19-i)<k;i--)
	{
		printf("%c",b[i]);
	}
}