import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String answer = "";

		for(int i=0; i<str.length(); i++){
			if(String.valueOf(str.charAt(i)).equals("B") && answer.length() != 0){
				answer = answer.substring(0, answer.length()-1);
			}else if(String.valueOf(str.charAt(i)).equals("0") || String.valueOf(str.charAt(i)).equals("1")){
				answer = answer + str.charAt(i);
			}
		}

		System.out.println(answer);
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String answer = "";

		for(int i=0; i<str.length(); i++){
			if(String.valueOf(str.charAt(i)).equals("B") && answer.length() != 0){
				answer = answer.substring(0, answer.length()-1);
			}else if(String.valueOf(str.charAt(i)).equals("0") || String.valueOf(str.charAt(i)).equals("1")){
				answer = answer + str.charAt(i);
			}
		}

		System.out.println(answer);
	}

} Main public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String answer = "";

		for(int i=0; i<str.length(); i++){
			if(String.valueOf(str.charAt(i)).equals("B") && answer.length() != 0){
				answer = answer.substring(0, answer.length()-1);
			}else if(String.valueOf(str.charAt(i)).equals("0") || String.valueOf(str.charAt(i)).equals("1")){
				answer = answer + str.charAt(i);
			}
		}

		System.out.println(answer);
	} main {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String answer = "";

		for(int i=0; i<str.length(); i++){
			if(String.valueOf(str.charAt(i)).equals("B") && answer.length() != 0){
				answer = answer.substring(0, answer.length()-1);
			}else if(String.valueOf(str.charAt(i)).equals("0") || String.valueOf(str.charAt(i)).equals("1")){
				answer = answer + str.charAt(i);
			}
		}

		System.out.println(answer);
	} BufferedReader input =new BufferedReader (new InputStreamReader (System.in)); input new BufferedReader (new InputStreamReader (System.in)) String str = input.readLine( ); str input.readLine( ) input.readLine input String answer = ""; answer "" for(int i=0; i<str.length(); i++){
			if(String.valueOf(str.charAt(i)).equals("B") && answer.length() != 0){
				answer = answer.substring(0, answer.length()-1);
			}else if(String.valueOf(str.charAt(i)).equals("0") || String.valueOf(str.charAt(i)).equals("1")){
				answer = answer + str.charAt(i);
			}
		} int i=0; int i=0; i 0 i<str.length() i str.length() str.length str i++ i++ i {
			if(String.valueOf(str.charAt(i)).equals("B") && answer.length() != 0){
				answer = answer.substring(0, answer.length()-1);
			}else if(String.valueOf(str.charAt(i)).equals("0") || String.valueOf(str.charAt(i)).equals("1")){
				answer = answer + str.charAt(i);
			}
		} {
			if(String.valueOf(str.charAt(i)).equals("B") && answer.length() != 0){
				answer = answer.substring(0, answer.length()-1);
			}else if(String.valueOf(str.charAt(i)).equals("0") || String.valueOf(str.charAt(i)).equals("1")){
				answer = answer + str.charAt(i);
			}
		} if(String.valueOf(str.charAt(i)).equals("B") && answer.length() != 0){
				answer = answer.substring(0, answer.length()-1);
			}else if(String.valueOf(str.charAt(i)).equals("0") || String.valueOf(str.charAt(i)).equals("1")){
				answer = answer + str.charAt(i);
			} String.valueOf(str.charAt(i)).equals("B") && answer.length() != 0 String.valueOf(str.charAt(i)).equals("B") String.valueOf(str.charAt(i)).equals String.valueOf(str.charAt(i)) String.valueOf String str.charAt(i) str.charAt str i "B" answer.length() != 0 answer.length() answer.length answer 0 {
				answer = answer.substring(0, answer.length()-1);
			} answer = answer.substring(0, answer.length()-1) answer answer.substring(0, answer.length()-1) answer.substring answer 0 answer.length()-1 answer.length() answer.length answer 1 if(String.valueOf(str.charAt(i)).equals("0") || String.valueOf(str.charAt(i)).equals("1")){
				answer = answer + str.charAt(i);
			} String.valueOf(str.charAt(i)).equals("0") || String.valueOf(str.charAt(i)).equals("1") String.valueOf(str.charAt(i)).equals("0") String.valueOf(str.charAt(i)).equals String.valueOf(str.charAt(i)) String.valueOf String str.charAt(i) str.charAt str i "0" String.valueOf(str.charAt(i)).equals("1") String.valueOf(str.charAt(i)).equals String.valueOf(str.charAt(i)) String.valueOf String str.charAt(i) str.charAt str i "1" {
				answer = answer + str.charAt(i);
			} answer = answer + str.charAt(i) answer answer + str.charAt(i) answer str.charAt(i) str.charAt str i System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String answer = "";

		for(int i=0; i<str.length(); i++){
			if(String.valueOf(str.charAt(i)).equals("B") && answer.length() != 0){
				answer = answer.substring(0, answer.length()-1);
			}else if(String.valueOf(str.charAt(i)).equals("0") || String.valueOf(str.charAt(i)).equals("1")){
				answer = answer + str.charAt(i);
			}
		}

		System.out.println(answer);
	}

} public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String answer = "";

		for(int i=0; i<str.length(); i++){
			if(String.valueOf(str.charAt(i)).equals("B") && answer.length() != 0){
				answer = answer.substring(0, answer.length()-1);
			}else if(String.valueOf(str.charAt(i)).equals("0") || String.valueOf(str.charAt(i)).equals("1")){
				answer = answer + str.charAt(i);
			}
		}

		System.out.println(answer);
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String answer = "";

		for(int i=0; i<str.length(); i++){
			if(String.valueOf(str.charAt(i)).equals("B") && answer.length() != 0){
				answer = answer.substring(0, answer.length()-1);
			}else if(String.valueOf(str.charAt(i)).equals("0") || String.valueOf(str.charAt(i)).equals("1")){
				answer = answer + str.charAt(i);
			}
		}

		System.out.println(answer);
	}

}
