

import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		Stack<Character> stack = new Stack<Character>();

		for(int i = 0; i < s.length(); i++){
			char c = s.charAt(i);

			switch(c){
			case '1':
			case '0':
				stack.push(c);
				break;
			case 'B':
				if(!stack.isEmpty()){
					stack.pop();
				}
			}
		}

		String result = "";
		while(!stack.isEmpty()){
			result = stack.pop() + result;
		}

		System.out.println(result);
	}
} import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		Stack<Character> stack = new Stack<Character>();

		for(int i = 0; i < s.length(); i++){
			char c = s.charAt(i);

			switch(c){
			case '1':
			case '0':
				stack.push(c);
				break;
			case 'B':
				if(!stack.isEmpty()){
					stack.pop();
				}
			}
		}

		String result = "";
		while(!stack.isEmpty()){
			result = stack.pop() + result;
		}

		System.out.println(result);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		Stack<Character> stack = new Stack<Character>();

		for(int i = 0; i < s.length(); i++){
			char c = s.charAt(i);

			switch(c){
			case '1':
			case '0':
				stack.push(c);
				break;
			case 'B':
				if(!stack.isEmpty()){
					stack.pop();
				}
			}
		}

		String result = "";
		while(!stack.isEmpty()){
			result = stack.pop() + result;
		}

		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		Stack<Character> stack = new Stack<Character>();

		for(int i = 0; i < s.length(); i++){
			char c = s.charAt(i);

			switch(c){
			case '1':
			case '0':
				stack.push(c);
				break;
			case 'B':
				if(!stack.isEmpty()){
					stack.pop();
				}
			}
		}

		String result = "";
		while(!stack.isEmpty()){
			result = stack.pop() + result;
		}

		System.out.println(result);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc Stack<Character> stack = new Stack<Character>(); stack new Stack<Character>() for(int i = 0; i < s.length(); i++){
			char c = s.charAt(i);

			switch(c){
			case '1':
			case '0':
				stack.push(c);
				break;
			case 'B':
				if(!stack.isEmpty()){
					stack.pop();
				}
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			char c = s.charAt(i);

			switch(c){
			case '1':
			case '0':
				stack.push(c);
				break;
			case 'B':
				if(!stack.isEmpty()){
					stack.pop();
				}
			}
		} {
			char c = s.charAt(i);

			switch(c){
			case '1':
			case '0':
				stack.push(c);
				break;
			case 'B':
				if(!stack.isEmpty()){
					stack.pop();
				}
			}
		} char c = s.charAt(i); c s.charAt(i) s.charAt s i switch(c){
			case '1':
			case '0':
				stack.push(c);
				break;
			case 'B':
				if(!stack.isEmpty()){
					stack.pop();
				}
			} c case '1': '1' case '1': case '0': '0' case '0': stack.push(c) stack.push stack c break; case 'B': 'B' case 'B': if(!stack.isEmpty()){
					stack.pop();
				} !stack.isEmpty() stack.isEmpty() stack.isEmpty stack {
					stack.pop();
				} stack.pop() stack.pop stack String result = ""; result "" while(!stack.isEmpty()){
			result = stack.pop() + result;
		} !stack.isEmpty() stack.isEmpty() stack.isEmpty stack {
			result = stack.pop() + result;
		} result = stack.pop() + result result stack.pop() + result stack.pop() stack.pop stack result System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		Stack<Character> stack = new Stack<Character>();

		for(int i = 0; i < s.length(); i++){
			char c = s.charAt(i);

			switch(c){
			case '1':
			case '0':
				stack.push(c);
				break;
			case 'B':
				if(!stack.isEmpty()){
					stack.pop();
				}
			}
		}

		String result = "";
		while(!stack.isEmpty()){
			result = stack.pop() + result;
		}

		System.out.println(result);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		Stack<Character> stack = new Stack<Character>();

		for(int i = 0; i < s.length(); i++){
			char c = s.charAt(i);

			switch(c){
			case '1':
			case '0':
				stack.push(c);
				break;
			case 'B':
				if(!stack.isEmpty()){
					stack.pop();
				}
			}
		}

		String result = "";
		while(!stack.isEmpty()){
			result = stack.pop() + result;
		}

		System.out.println(result);
	}
} Main


import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		Stack<Character> stack = new Stack<Character>();

		for(int i = 0; i < s.length(); i++){
			char c = s.charAt(i);

			switch(c){
			case '1':
			case '0':
				stack.push(c);
				break;
			case 'B':
				if(!stack.isEmpty()){
					stack.pop();
				}
			}
		}

		String result = "";
		while(!stack.isEmpty()){
			result = stack.pop() + result;
		}

		System.out.println(result);
	}
}