import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//文字取得
		String s = sc.next();
		String answer = "";
		sc.close();

		for(int i = 0; i < s.length(); i++) {
			char character = s.charAt(i);
			//System.out.println(character);

			if(character == '0' || character == '1') {
				answer += character;
			}else if(character == 'B') {
				if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				}
			}
		}

		System.out.println(answer);
	}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//文字取得
		String s = sc.next();
		String answer = "";
		sc.close();

		for(int i = 0; i < s.length(); i++) {
			char character = s.charAt(i);
			//System.out.println(character);

			if(character == '0' || character == '1') {
				answer += character;
			}else if(character == 'B') {
				if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				}
			}
		}

		System.out.println(answer);
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//文字取得
		String s = sc.next();
		String answer = "";
		sc.close();

		for(int i = 0; i < s.length(); i++) {
			char character = s.charAt(i);
			//System.out.println(character);

			if(character == '0' || character == '1') {
				answer += character;
			}else if(character == 'B') {
				if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				}
			}
		}

		System.out.println(answer);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//文字取得
		String s = sc.next();
		String answer = "";
		sc.close();

		for(int i = 0; i < s.length(); i++) {
			char character = s.charAt(i);
			//System.out.println(character);

			if(character == '0' || character == '1') {
				answer += character;
			}else if(character == 'B') {
				if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				}
			}
		}

		System.out.println(answer);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String answer = ""; answer "" sc.close() sc.close sc for(int i = 0; i < s.length(); i++) {
			char character = s.charAt(i);
			//System.out.println(character);

			if(character == '0' || character == '1') {
				answer += character;
			}else if(character == 'B') {
				if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				}
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			char character = s.charAt(i);
			//System.out.println(character);

			if(character == '0' || character == '1') {
				answer += character;
			}else if(character == 'B') {
				if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				}
			}
		} {
			char character = s.charAt(i);
			//System.out.println(character);

			if(character == '0' || character == '1') {
				answer += character;
			}else if(character == 'B') {
				if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				}
			}
		} char character = s.charAt(i); character s.charAt(i) s.charAt s i if(character == '0' || character == '1') {
				answer += character;
			}else if(character == 'B') {
				if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				}
			} character == '0' || character == '1' character == '0' character '0' character == '1' character '1' {
				answer += character;
			} answer += character answer character if(character == 'B') {
				if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				}
			} character == 'B' character 'B' {
				if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				}
			} if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				} answer.length() == 0 answer.length() answer.length answer 0 {
					//何もしない
				} {
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				} answer = answer.substring(0, answer.length()-1) answer answer.substring(0, answer.length()-1) answer.substring answer 0 answer.length()-1 answer.length() answer.length answer 1 System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//文字取得
		String s = sc.next();
		String answer = "";
		sc.close();

		for(int i = 0; i < s.length(); i++) {
			char character = s.charAt(i);
			//System.out.println(character);

			if(character == '0' || character == '1') {
				answer += character;
			}else if(character == 'B') {
				if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				}
			}
		}

		System.out.println(answer);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//文字取得
		String s = sc.next();
		String answer = "";
		sc.close();

		for(int i = 0; i < s.length(); i++) {
			char character = s.charAt(i);
			//System.out.println(character);

			if(character == '0' || character == '1') {
				answer += character;
			}else if(character == 'B') {
				if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				}
			}
		}

		System.out.println(answer);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//文字取得
		String s = sc.next();
		String answer = "";
		sc.close();

		for(int i = 0; i < s.length(); i++) {
			char character = s.charAt(i);
			//System.out.println(character);

			if(character == '0' || character == '1') {
				answer += character;
			}else if(character == 'B') {
				if(answer.length() == 0) {
					//何もしない
				}else{
					//文字があったら削る
					answer = answer.substring(0, answer.length()-1);
				}
			}
		}

		System.out.println(answer);
	}

}
