import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		ArrayList<Character> c = new ArrayList<Character>();
		char[] C = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			C[i] = s.charAt(i);
			}
		for (int i = 0; i < s.length(); i++) {
			if (C[i] == '1') {
				c.add('1');
			}
			if (C[i] == '0') {
				c.add('0');
			}
			if (C[i] == 'B' && c.size()>0) {
				c.remove(c.size()-1);
			}
		}
		for (int i = 0; i < c.size(); i++) {
			System.out.print(c.get(i));
		}
	}
}
 import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		ArrayList<Character> c = new ArrayList<Character>();
		char[] C = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			C[i] = s.charAt(i);
			}
		for (int i = 0; i < s.length(); i++) {
			if (C[i] == '1') {
				c.add('1');
			}
			if (C[i] == '0') {
				c.add('0');
			}
			if (C[i] == 'B' && c.size()>0) {
				c.remove(c.size()-1);
			}
		}
		for (int i = 0; i < c.size(); i++) {
			System.out.print(c.get(i));
		}
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		ArrayList<Character> c = new ArrayList<Character>();
		char[] C = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			C[i] = s.charAt(i);
			}
		for (int i = 0; i < s.length(); i++) {
			if (C[i] == '1') {
				c.add('1');
			}
			if (C[i] == '0') {
				c.add('0');
			}
			if (C[i] == 'B' && c.size()>0) {
				c.remove(c.size()-1);
			}
		}
		for (int i = 0; i < c.size(); i++) {
			System.out.print(c.get(i));
		}
	} main {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		ArrayList<Character> c = new ArrayList<Character>();
		char[] C = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			C[i] = s.charAt(i);
			}
		for (int i = 0; i < s.length(); i++) {
			if (C[i] == '1') {
				c.add('1');
			}
			if (C[i] == '0') {
				c.add('0');
			}
			if (C[i] == 'B' && c.size()>0) {
				c.remove(c.size()-1);
			}
		}
		for (int i = 0; i < c.size(); i++) {
			System.out.print(c.get(i));
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan ArrayList<Character> c = new ArrayList<Character>(); c new ArrayList<Character>() char[] C = new char[s.length()]; C new char[s.length()] s.length() s.length s for (int i = 0; i < s.length(); i++) {
			C[i] = s.charAt(i);
			} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			C[i] = s.charAt(i);
			} {
			C[i] = s.charAt(i);
			} C[i] = s.charAt(i) C[i] C i s.charAt(i) s.charAt s i for (int i = 0; i < s.length(); i++) {
			if (C[i] == '1') {
				c.add('1');
			}
			if (C[i] == '0') {
				c.add('0');
			}
			if (C[i] == 'B' && c.size()>0) {
				c.remove(c.size()-1);
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			if (C[i] == '1') {
				c.add('1');
			}
			if (C[i] == '0') {
				c.add('0');
			}
			if (C[i] == 'B' && c.size()>0) {
				c.remove(c.size()-1);
			}
		} {
			if (C[i] == '1') {
				c.add('1');
			}
			if (C[i] == '0') {
				c.add('0');
			}
			if (C[i] == 'B' && c.size()>0) {
				c.remove(c.size()-1);
			}
		} if (C[i] == '1') {
				c.add('1');
			} C[i] == '1' C[i] C i '1' {
				c.add('1');
			} c.add('1') c.add c '1' if (C[i] == '0') {
				c.add('0');
			} C[i] == '0' C[i] C i '0' {
				c.add('0');
			} c.add('0') c.add c '0' if (C[i] == 'B' && c.size()>0) {
				c.remove(c.size()-1);
			} C[i] == 'B' && c.size()>0 C[i] == 'B' C[i] C i 'B' c.size()>0 c.size() c.size c 0 {
				c.remove(c.size()-1);
			} c.remove(c.size()-1) c.remove c c.size()-1 c.size() c.size c 1 for (int i = 0; i < c.size(); i++) {
			System.out.print(c.get(i));
		} int i = 0; int i = 0; i 0 i < c.size() i c.size() c.size c i++ i++ i {
			System.out.print(c.get(i));
		} {
			System.out.print(c.get(i));
		} System.out.print(c.get(i)) System.out.print System.out System System.out c.get(i) c.get c i String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		ArrayList<Character> c = new ArrayList<Character>();
		char[] C = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			C[i] = s.charAt(i);
			}
		for (int i = 0; i < s.length(); i++) {
			if (C[i] == '1') {
				c.add('1');
			}
			if (C[i] == '0') {
				c.add('0');
			}
			if (C[i] == 'B' && c.size()>0) {
				c.remove(c.size()-1);
			}
		}
		for (int i = 0; i < c.size(); i++) {
			System.out.print(c.get(i));
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		ArrayList<Character> c = new ArrayList<Character>();
		char[] C = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			C[i] = s.charAt(i);
			}
		for (int i = 0; i < s.length(); i++) {
			if (C[i] == '1') {
				c.add('1');
			}
			if (C[i] == '0') {
				c.add('0');
			}
			if (C[i] == 'B' && c.size()>0) {
				c.remove(c.size()-1);
			}
		}
		for (int i = 0; i < c.size(); i++) {
			System.out.print(c.get(i));
		}
	}
} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		ArrayList<Character> c = new ArrayList<Character>();
		char[] C = new char[s.length()];
		for (int i = 0; i < s.length(); i++) {
			C[i] = s.charAt(i);
			}
		for (int i = 0; i < s.length(); i++) {
			if (C[i] == '1') {
				c.add('1');
			}
			if (C[i] == '0') {
				c.add('0');
			}
			if (C[i] == 'B' && c.size()>0) {
				c.remove(c.size()-1);
			}
		}
		for (int i = 0; i < c.size(); i++) {
			System.out.print(c.get(i));
		}
	}
}

