import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ary = sc.next().toCharArray();
		String str = "";
		for (char c : ary) {
			if(c == '0') str += "0";
			if(c == '1') str += "1";
			if(c == 'B' && !str.equals("")) {
				str = str.substring(0,str.length()-1);
			}
		}
		System.out.println(str);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ary = sc.next().toCharArray();
		String str = "";
		for (char c : ary) {
			if(c == '0') str += "0";
			if(c == '1') str += "1";
			if(c == 'B' && !str.equals("")) {
				str = str.substring(0,str.length()-1);
			}
		}
		System.out.println(str);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ary = sc.next().toCharArray();
		String str = "";
		for (char c : ary) {
			if(c == '0') str += "0";
			if(c == '1') str += "1";
			if(c == 'B' && !str.equals("")) {
				str = str.substring(0,str.length()-1);
			}
		}
		System.out.println(str);
	} main {
		Scanner sc = new Scanner(System.in);
		char[] ary = sc.next().toCharArray();
		String str = "";
		for (char c : ary) {
			if(c == '0') str += "0";
			if(c == '1') str += "1";
			if(c == 'B' && !str.equals("")) {
				str = str.substring(0,str.length()-1);
			}
		}
		System.out.println(str);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] ary = sc.next().toCharArray(); ary sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc String str = ""; str "" for (char c : ary) {
			if(c == '0') str += "0";
			if(c == '1') str += "1";
			if(c == 'B' && !str.equals("")) {
				str = str.substring(0,str.length()-1);
			}
		} char c ary {
			if(c == '0') str += "0";
			if(c == '1') str += "1";
			if(c == 'B' && !str.equals("")) {
				str = str.substring(0,str.length()-1);
			}
		} {
			if(c == '0') str += "0";
			if(c == '1') str += "1";
			if(c == 'B' && !str.equals("")) {
				str = str.substring(0,str.length()-1);
			}
		} if(c == '0') str += "0"; c == '0' c '0' str += "0" str "0" if(c == '1') str += "1"; c == '1' c '1' str += "1" str "1" if(c == 'B' && !str.equals("")) {
				str = str.substring(0,str.length()-1);
			} c == 'B' && !str.equals("") c == 'B' c 'B' !str.equals("") str.equals("") str.equals str "" {
				str = str.substring(0,str.length()-1);
			} str = str.substring(0,str.length()-1) str str.substring(0,str.length()-1) str.substring str 0 str.length()-1 str.length() str.length str 1 System.out.println(str) System.out.println System.out System System.out str String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ary = sc.next().toCharArray();
		String str = "";
		for (char c : ary) {
			if(c == '0') str += "0";
			if(c == '1') str += "1";
			if(c == 'B' && !str.equals("")) {
				str = str.substring(0,str.length()-1);
			}
		}
		System.out.println(str);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ary = sc.next().toCharArray();
		String str = "";
		for (char c : ary) {
			if(c == '0') str += "0";
			if(c == '1') str += "1";
			if(c == 'B' && !str.equals("")) {
				str = str.substring(0,str.length()-1);
			}
		}
		System.out.println(str);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ary = sc.next().toCharArray();
		String str = "";
		for (char c : ary) {
			if(c == '0') str += "0";
			if(c == '1') str += "1";
			if(c == 'B' && !str.equals("")) {
				str = str.substring(0,str.length()-1);
			}
		}
		System.out.println(str);
	}
}