
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

class Main {
	public static void main(String[] args) throws java.lang.Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//int n = Integer.parseInt(br.readLine());
		//String[] arg = br.readLine().split(" ");
		//int[] inp = new int[arg.length];
		Solver s = new Solver();
		

		System.out.println(s.solve(br.readLine()));
	}

}

class Solver {

	String solve(String inp) {

		StringBuilder sb = new StringBuilder();
		for(int i = 0;i<inp.length();i++) {
			if(inp.charAt(i)=='B' && sb.length()==0) {
				continue;
			}
			if(inp.charAt(i)=='0'||inp.charAt(i)=='1') {
				sb.append(inp.charAt(i));
			}if(inp.charAt(i)=='B') {
				sb.deleteCharAt(sb.length()-1);
			}
		}
		return sb.toString();
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util class Main {
	public static void main(String[] args) throws java.lang.Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//int n = Integer.parseInt(br.readLine());
		//String[] arg = br.readLine().split(" ");
		//int[] inp = new int[arg.length];
		Solver s = new Solver();
		

		System.out.println(s.solve(br.readLine()));
	}

} Main public static void main(String[] args) throws java.lang.Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//int n = Integer.parseInt(br.readLine());
		//String[] arg = br.readLine().split(" ");
		//int[] inp = new int[arg.length];
		Solver s = new Solver();
		

		System.out.println(s.solve(br.readLine()));
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//int n = Integer.parseInt(br.readLine());
		//String[] arg = br.readLine().split(" ");
		//int[] inp = new int[arg.length];
		Solver s = new Solver();
		

		System.out.println(s.solve(br.readLine()));
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) Solver s = new Solver(); s new Solver() System.out.println(s.solve(br.readLine())) System.out.println System.out System System.out s.solve(br.readLine()) s.solve s br.readLine() br.readLine br String[] args args class Solver {

	String solve(String inp) {

		StringBuilder sb = new StringBuilder();
		for(int i = 0;i<inp.length();i++) {
			if(inp.charAt(i)=='B' && sb.length()==0) {
				continue;
			}
			if(inp.charAt(i)=='0'||inp.charAt(i)=='1') {
				sb.append(inp.charAt(i));
			}if(inp.charAt(i)=='B') {
				sb.deleteCharAt(sb.length()-1);
			}
		}
		return sb.toString();
	}

} Solver String solve(String inp) {

		StringBuilder sb = new StringBuilder();
		for(int i = 0;i<inp.length();i++) {
			if(inp.charAt(i)=='B' && sb.length()==0) {
				continue;
			}
			if(inp.charAt(i)=='0'||inp.charAt(i)=='1') {
				sb.append(inp.charAt(i));
			}if(inp.charAt(i)=='B') {
				sb.deleteCharAt(sb.length()-1);
			}
		}
		return sb.toString();
	} solve {

		StringBuilder sb = new StringBuilder();
		for(int i = 0;i<inp.length();i++) {
			if(inp.charAt(i)=='B' && sb.length()==0) {
				continue;
			}
			if(inp.charAt(i)=='0'||inp.charAt(i)=='1') {
				sb.append(inp.charAt(i));
			}if(inp.charAt(i)=='B') {
				sb.deleteCharAt(sb.length()-1);
			}
		}
		return sb.toString();
	} StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0;i<inp.length();i++) {
			if(inp.charAt(i)=='B' && sb.length()==0) {
				continue;
			}
			if(inp.charAt(i)=='0'||inp.charAt(i)=='1') {
				sb.append(inp.charAt(i));
			}if(inp.charAt(i)=='B') {
				sb.deleteCharAt(sb.length()-1);
			}
		} int i = 0; int i = 0; i 0 i<inp.length() i inp.length() inp.length inp i++ i++ i {
			if(inp.charAt(i)=='B' && sb.length()==0) {
				continue;
			}
			if(inp.charAt(i)=='0'||inp.charAt(i)=='1') {
				sb.append(inp.charAt(i));
			}if(inp.charAt(i)=='B') {
				sb.deleteCharAt(sb.length()-1);
			}
		} {
			if(inp.charAt(i)=='B' && sb.length()==0) {
				continue;
			}
			if(inp.charAt(i)=='0'||inp.charAt(i)=='1') {
				sb.append(inp.charAt(i));
			}if(inp.charAt(i)=='B') {
				sb.deleteCharAt(sb.length()-1);
			}
		} if(inp.charAt(i)=='B' && sb.length()==0) {
				continue;
			} inp.charAt(i)=='B' && sb.length()==0 inp.charAt(i)=='B' inp.charAt(i) inp.charAt inp i 'B' sb.length()==0 sb.length() sb.length sb 0 {
				continue;
			} continue; if(inp.charAt(i)=='0'||inp.charAt(i)=='1') {
				sb.append(inp.charAt(i));
			} inp.charAt(i)=='0'||inp.charAt(i)=='1' inp.charAt(i)=='0' inp.charAt(i) inp.charAt inp i '0' inp.charAt(i)=='1' inp.charAt(i) inp.charAt inp i '1' {
				sb.append(inp.charAt(i));
			} sb.append(inp.charAt(i)) sb.append sb inp.charAt(i) inp.charAt inp i if(inp.charAt(i)=='B') {
				sb.deleteCharAt(sb.length()-1);
			} inp.charAt(i)=='B' inp.charAt(i) inp.charAt inp i 'B' {
				sb.deleteCharAt(sb.length()-1);
			} sb.deleteCharAt(sb.length()-1) sb.deleteCharAt sb sb.length()-1 sb.length() sb.length sb 1 return sb.toString(); sb.toString() sb.toString sb String inp inp

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

class Main {
	public static void main(String[] args) throws java.lang.Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//int n = Integer.parseInt(br.readLine());
		//String[] arg = br.readLine().split(" ");
		//int[] inp = new int[arg.length];
		Solver s = new Solver();
		

		System.out.println(s.solve(br.readLine()));
	}

}

class Solver {

	String solve(String inp) {

		StringBuilder sb = new StringBuilder();
		for(int i = 0;i<inp.length();i++) {
			if(inp.charAt(i)=='B' && sb.length()==0) {
				continue;
			}
			if(inp.charAt(i)=='0'||inp.charAt(i)=='1') {
				sb.append(inp.charAt(i));
			}if(inp.charAt(i)=='B') {
				sb.deleteCharAt(sb.length()-1);
			}
		}
		return sb.toString();
	}

}