import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		char[] line = scanner.next().toCharArray();

		Deque<Character> q = new ArrayDeque<Character>();

		for (int i = 0; i < line.length; i++) {
			if (line[i] == '0') {
				q.addLast('0');
			} else if(line[i] == '1'){
				q.addLast('1');
			} else if(line[i] == 'B'){
				if (q.size() != 0) {
					q.removeLast();
				} 
			}
		}

		for (Character character : q) {
			System.out.print(character);
		}

		System.out.println();

		scanner.close();
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		char[] line = scanner.next().toCharArray();

		Deque<Character> q = new ArrayDeque<Character>();

		for (int i = 0; i < line.length; i++) {
			if (line[i] == '0') {
				q.addLast('0');
			} else if(line[i] == '1'){
				q.addLast('1');
			} else if(line[i] == 'B'){
				if (q.size() != 0) {
					q.removeLast();
				} 
			}
		}

		for (Character character : q) {
			System.out.print(character);
		}

		System.out.println();

		scanner.close();
	}

} Main public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		char[] line = scanner.next().toCharArray();

		Deque<Character> q = new ArrayDeque<Character>();

		for (int i = 0; i < line.length; i++) {
			if (line[i] == '0') {
				q.addLast('0');
			} else if(line[i] == '1'){
				q.addLast('1');
			} else if(line[i] == 'B'){
				if (q.size() != 0) {
					q.removeLast();
				} 
			}
		}

		for (Character character : q) {
			System.out.print(character);
		}

		System.out.println();

		scanner.close();
	} main {
		Scanner scanner =new Scanner(System.in);
		char[] line = scanner.next().toCharArray();

		Deque<Character> q = new ArrayDeque<Character>();

		for (int i = 0; i < line.length; i++) {
			if (line[i] == '0') {
				q.addLast('0');
			} else if(line[i] == '1'){
				q.addLast('1');
			} else if(line[i] == 'B'){
				if (q.size() != 0) {
					q.removeLast();
				} 
			}
		}

		for (Character character : q) {
			System.out.print(character);
		}

		System.out.println();

		scanner.close();
	} Scanner scanner =new Scanner(System.in); scanner new Scanner(System.in) char[] line = scanner.next().toCharArray(); line scanner.next().toCharArray() scanner.next().toCharArray scanner.next() scanner.next scanner Deque<Character> q = new ArrayDeque<Character>(); q new ArrayDeque<Character>() for (int i = 0; i < line.length; i++) {
			if (line[i] == '0') {
				q.addLast('0');
			} else if(line[i] == '1'){
				q.addLast('1');
			} else if(line[i] == 'B'){
				if (q.size() != 0) {
					q.removeLast();
				} 
			}
		} int i = 0; int i = 0; i 0 i < line.length i line.length line line.length i++ i++ i {
			if (line[i] == '0') {
				q.addLast('0');
			} else if(line[i] == '1'){
				q.addLast('1');
			} else if(line[i] == 'B'){
				if (q.size() != 0) {
					q.removeLast();
				} 
			}
		} {
			if (line[i] == '0') {
				q.addLast('0');
			} else if(line[i] == '1'){
				q.addLast('1');
			} else if(line[i] == 'B'){
				if (q.size() != 0) {
					q.removeLast();
				} 
			}
		} if (line[i] == '0') {
				q.addLast('0');
			} else if(line[i] == '1'){
				q.addLast('1');
			} else if(line[i] == 'B'){
				if (q.size() != 0) {
					q.removeLast();
				} 
			} line[i] == '0' line[i] line i '0' {
				q.addLast('0');
			} q.addLast('0') q.addLast q '0' if(line[i] == '1'){
				q.addLast('1');
			} else if(line[i] == 'B'){
				if (q.size() != 0) {
					q.removeLast();
				} 
			} line[i] == '1' line[i] line i '1' {
				q.addLast('1');
			} q.addLast('1') q.addLast q '1' if(line[i] == 'B'){
				if (q.size() != 0) {
					q.removeLast();
				} 
			} line[i] == 'B' line[i] line i 'B' {
				if (q.size() != 0) {
					q.removeLast();
				} 
			} if (q.size() != 0) {
					q.removeLast();
				} q.size() != 0 q.size() q.size q 0 {
					q.removeLast();
				} q.removeLast() q.removeLast q for (Character character : q) {
			System.out.print(character);
		} Character character q {
			System.out.print(character);
		} {
			System.out.print(character);
		} System.out.print(character) System.out.print System.out System System.out character System.out.println() System.out.println System.out System System.out scanner.close() scanner.close scanner String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		char[] line = scanner.next().toCharArray();

		Deque<Character> q = new ArrayDeque<Character>();

		for (int i = 0; i < line.length; i++) {
			if (line[i] == '0') {
				q.addLast('0');
			} else if(line[i] == '1'){
				q.addLast('1');
			} else if(line[i] == 'B'){
				if (q.size() != 0) {
					q.removeLast();
				} 
			}
		}

		for (Character character : q) {
			System.out.print(character);
		}

		System.out.println();

		scanner.close();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		char[] line = scanner.next().toCharArray();

		Deque<Character> q = new ArrayDeque<Character>();

		for (int i = 0; i < line.length; i++) {
			if (line[i] == '0') {
				q.addLast('0');
			} else if(line[i] == '1'){
				q.addLast('1');
			} else if(line[i] == 'B'){
				if (q.size() != 0) {
					q.removeLast();
				} 
			}
		}

		for (Character character : q) {
			System.out.print(character);
		}

		System.out.println();

		scanner.close();
	}

} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		char[] line = scanner.next().toCharArray();

		Deque<Character> q = new ArrayDeque<Character>();

		for (int i = 0; i < line.length; i++) {
			if (line[i] == '0') {
				q.addLast('0');
			} else if(line[i] == '1'){
				q.addLast('1');
			} else if(line[i] == 'B'){
				if (q.size() != 0) {
					q.removeLast();
				} 
			}
		}

		for (Character character : q) {
			System.out.print(character);
		}

		System.out.println();

		scanner.close();
	}

}
