import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder str = new StringBuilder();
		int pointer = 0;
		for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
			case '0':
				str.append('0');
				pointer++;
				break;
			case '1':
				str.append('1');
				pointer++;
				break;
			case 'B':
				if(pointer == 0){
					break;
				}
				str.deleteCharAt(pointer -1);
				pointer--;
				break;
			default:
				break;
			}
		}
		System.out.println(str.toString());
		sc.close();
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder str = new StringBuilder();
		int pointer = 0;
		for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
			case '0':
				str.append('0');
				pointer++;
				break;
			case '1':
				str.append('1');
				pointer++;
				break;
			case 'B':
				if(pointer == 0){
					break;
				}
				str.deleteCharAt(pointer -1);
				pointer--;
				break;
			default:
				break;
			}
		}
		System.out.println(str.toString());
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder str = new StringBuilder();
		int pointer = 0;
		for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
			case '0':
				str.append('0');
				pointer++;
				break;
			case '1':
				str.append('1');
				pointer++;
				break;
			case 'B':
				if(pointer == 0){
					break;
				}
				str.deleteCharAt(pointer -1);
				pointer--;
				break;
			default:
				break;
			}
		}
		System.out.println(str.toString());
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder str = new StringBuilder();
		int pointer = 0;
		for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
			case '0':
				str.append('0');
				pointer++;
				break;
			case '1':
				str.append('1');
				pointer++;
				break;
			case 'B':
				if(pointer == 0){
					break;
				}
				str.deleteCharAt(pointer -1);
				pointer--;
				break;
			default:
				break;
			}
		}
		System.out.println(str.toString());
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc StringBuilder str = new StringBuilder(); str new StringBuilder() int pointer = 0; pointer 0 for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
			case '0':
				str.append('0');
				pointer++;
				break;
			case '1':
				str.append('1');
				pointer++;
				break;
			case 'B':
				if(pointer == 0){
					break;
				}
				str.deleteCharAt(pointer -1);
				pointer--;
				break;
			default:
				break;
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			switch (s.charAt(i)) {
			case '0':
				str.append('0');
				pointer++;
				break;
			case '1':
				str.append('1');
				pointer++;
				break;
			case 'B':
				if(pointer == 0){
					break;
				}
				str.deleteCharAt(pointer -1);
				pointer--;
				break;
			default:
				break;
			}
		} {
			switch (s.charAt(i)) {
			case '0':
				str.append('0');
				pointer++;
				break;
			case '1':
				str.append('1');
				pointer++;
				break;
			case 'B':
				if(pointer == 0){
					break;
				}
				str.deleteCharAt(pointer -1);
				pointer--;
				break;
			default:
				break;
			}
		} switch (s.charAt(i)) {
			case '0':
				str.append('0');
				pointer++;
				break;
			case '1':
				str.append('1');
				pointer++;
				break;
			case 'B':
				if(pointer == 0){
					break;
				}
				str.deleteCharAt(pointer -1);
				pointer--;
				break;
			default:
				break;
			} s.charAt(i) s.charAt s i case '0': '0' case '0': str.append('0') str.append str '0' pointer++ pointer break; case '1': '1' case '1': str.append('1') str.append str '1' pointer++ pointer break; case 'B': 'B' case 'B': if(pointer == 0){
					break;
				} pointer == 0 pointer 0 {
					break;
				} break; str.deleteCharAt(pointer -1) str.deleteCharAt str pointer -1 pointer 1 pointer-- pointer break; default: default: break; System.out.println(str.toString()) System.out.println System.out System System.out str.toString() str.toString str sc.close() sc.close sc String[] args args
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder str = new StringBuilder();
		int pointer = 0;
		for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
			case '0':
				str.append('0');
				pointer++;
				break;
			case '1':
				str.append('1');
				pointer++;
				break;
			case 'B':
				if(pointer == 0){
					break;
				}
				str.deleteCharAt(pointer -1);
				pointer--;
				break;
			default:
				break;
			}
		}
		System.out.println(str.toString());
		sc.close();
	}
}
