import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		ArrayList<Character> al = new ArrayList<Character>();

		for (int i = 0; i < c.length; i++) {
			if (c[i] == '0') {
				al.add('0');
			} else if (c[i] == '1') {
				al.add('1');
			} else if (c[i] == 'B' && al.size() != 0) {
				al.remove(al.size() - 1);
			}
		}

		for (int i = 0; i < al.size(); i++) {

			System.out.print(al.get(i));
		}
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		ArrayList<Character> al = new ArrayList<Character>();

		for (int i = 0; i < c.length; i++) {
			if (c[i] == '0') {
				al.add('0');
			} else if (c[i] == '1') {
				al.add('1');
			} else if (c[i] == 'B' && al.size() != 0) {
				al.remove(al.size() - 1);
			}
		}

		for (int i = 0; i < al.size(); i++) {

			System.out.print(al.get(i));
		}
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		ArrayList<Character> al = new ArrayList<Character>();

		for (int i = 0; i < c.length; i++) {
			if (c[i] == '0') {
				al.add('0');
			} else if (c[i] == '1') {
				al.add('1');
			} else if (c[i] == 'B' && al.size() != 0) {
				al.remove(al.size() - 1);
			}
		}

		for (int i = 0; i < al.size(); i++) {

			System.out.print(al.get(i));
		}
	} main {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		ArrayList<Character> al = new ArrayList<Character>();

		for (int i = 0; i < c.length; i++) {
			if (c[i] == '0') {
				al.add('0');
			} else if (c[i] == '1') {
				al.add('1');
			} else if (c[i] == 'B' && al.size() != 0) {
				al.remove(al.size() - 1);
			}
		}

		for (int i = 0; i < al.size(); i++) {

			System.out.print(al.get(i));
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc char[] c = s.toCharArray(); c s.toCharArray() s.toCharArray s ArrayList<Character> al = new ArrayList<Character>(); al new ArrayList<Character>() for (int i = 0; i < c.length; i++) {
			if (c[i] == '0') {
				al.add('0');
			} else if (c[i] == '1') {
				al.add('1');
			} else if (c[i] == 'B' && al.size() != 0) {
				al.remove(al.size() - 1);
			}
		} int i = 0; int i = 0; i 0 i < c.length i c.length c c.length i++ i++ i {
			if (c[i] == '0') {
				al.add('0');
			} else if (c[i] == '1') {
				al.add('1');
			} else if (c[i] == 'B' && al.size() != 0) {
				al.remove(al.size() - 1);
			}
		} {
			if (c[i] == '0') {
				al.add('0');
			} else if (c[i] == '1') {
				al.add('1');
			} else if (c[i] == 'B' && al.size() != 0) {
				al.remove(al.size() - 1);
			}
		} if (c[i] == '0') {
				al.add('0');
			} else if (c[i] == '1') {
				al.add('1');
			} else if (c[i] == 'B' && al.size() != 0) {
				al.remove(al.size() - 1);
			} c[i] == '0' c[i] c i '0' {
				al.add('0');
			} al.add('0') al.add al '0' if (c[i] == '1') {
				al.add('1');
			} else if (c[i] == 'B' && al.size() != 0) {
				al.remove(al.size() - 1);
			} c[i] == '1' c[i] c i '1' {
				al.add('1');
			} al.add('1') al.add al '1' if (c[i] == 'B' && al.size() != 0) {
				al.remove(al.size() - 1);
			} c[i] == 'B' && al.size() != 0 c[i] == 'B' c[i] c i 'B' al.size() != 0 al.size() al.size al 0 {
				al.remove(al.size() - 1);
			} al.remove(al.size() - 1) al.remove al al.size() - 1 al.size() al.size al 1 for (int i = 0; i < al.size(); i++) {

			System.out.print(al.get(i));
		} int i = 0; int i = 0; i 0 i < al.size() i al.size() al.size al i++ i++ i {

			System.out.print(al.get(i));
		} {

			System.out.print(al.get(i));
		} System.out.print(al.get(i)) System.out.print System.out System System.out al.get(i) al.get al i String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		ArrayList<Character> al = new ArrayList<Character>();

		for (int i = 0; i < c.length; i++) {
			if (c[i] == '0') {
				al.add('0');
			} else if (c[i] == '1') {
				al.add('1');
			} else if (c[i] == 'B' && al.size() != 0) {
				al.remove(al.size() - 1);
			}
		}

		for (int i = 0; i < al.size(); i++) {

			System.out.print(al.get(i));
		}
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		ArrayList<Character> al = new ArrayList<Character>();

		for (int i = 0; i < c.length; i++) {
			if (c[i] == '0') {
				al.add('0');
			} else if (c[i] == '1') {
				al.add('1');
			} else if (c[i] == 'B' && al.size() != 0) {
				al.remove(al.size() - 1);
			}
		}

		for (int i = 0; i < al.size(); i++) {

			System.out.print(al.get(i));
		}
	}
} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		ArrayList<Character> al = new ArrayList<Character>();

		for (int i = 0; i < c.length; i++) {
			if (c[i] == '0') {
				al.add('0');
			} else if (c[i] == '1') {
				al.add('1');
			} else if (c[i] == 'B' && al.size() != 0) {
				al.remove(al.size() - 1);
			}
		}

		for (int i = 0; i < al.size(); i++) {

			System.out.print(al.get(i));
		}
	}
}