import std.stdio;

void main(){
	auto cin = new Cin();
	auto S = cin.rect!(char[],"")()[0];
	//writeln(S);
	char[] c;
	foreach( s ; S ){
		switch( s ){
			case "0":
				c ~= "0";
				break;
			case "1":
				c ~= "1";
				break;
			case "B":
				c.length = 0<c.length ? c.length-1 : 0 ;
				break;
			default:break;
		}
	}
	
	(c).writeln();
}
auto solve(){
}
unittest{
	
}


import std.stdio,std.conv,std.string;
import std.algorithm,std.array;

class Cin
{
	T[] line( T = size_t , string token = " " )( size_t m = 1 ){
		T[] arr = [];
		foreach( i ; 0..m ){
			arr ~= this.read!T();
		}
		return arr;
	}
	T[][] rect( T = size_t , string token = " " )( size_t m = 1 ){
		T[][] arr = new T[][](m);
		foreach( i ; 0..m ){
			arr[i] = this.read!T(token);
		}
		return arr;
	}
	private T[] read( T = size_t )( string token = " " ){
		T[] arr;
		foreach( elm ; readln().chomp().split(token) ){
			arr ~= elm.to!T();
		}
		return arr;
	}
}