unittest
{
	assert( [ "01B0" ].parse.expand.solve == "00" );
	assert( [ "0BB1" ].parse.expand.solve == "1" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front;
	return tuple( s );
}

auto solve( string s )
{
	auto ans = "";
	foreach( c; s )
	{
		if( c == 'B' )
		{
			if( 0 < ans.length ) ans.length--;
		}
		else
		{
			ans ~= c;
		}
	}
	return ans;
}
