import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split("");
		String answer = "";

		for (int i = 0; i < line.length; i++) {
			switch (line[i]) {
			case "0":
			case "1":
				answer = answer + line[i];
				break;
			case "B":
				if (!(answer.equals(""))) {
					answer = answer.substring(0, answer.length() - 1);

				}
			}
		}

		System.out.println(answer);

	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split("");
		String answer = "";

		for (int i = 0; i < line.length; i++) {
			switch (line[i]) {
			case "0":
			case "1":
				answer = answer + line[i];
				break;
			case "B":
				if (!(answer.equals(""))) {
					answer = answer.substring(0, answer.length() - 1);

				}
			}
		}

		System.out.println(answer);

	}
} Main public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split("");
		String answer = "";

		for (int i = 0; i < line.length; i++) {
			switch (line[i]) {
			case "0":
			case "1":
				answer = answer + line[i];
				break;
			case "B":
				if (!(answer.equals(""))) {
					answer = answer.substring(0, answer.length() - 1);

				}
			}
		}

		System.out.println(answer);

	} main {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split("");
		String answer = "";

		for (int i = 0; i < line.length; i++) {
			switch (line[i]) {
			case "0":
			case "1":
				answer = answer + line[i];
				break;
			case "B":
				if (!(answer.equals(""))) {
					answer = answer.substring(0, answer.length() - 1);

				}
			}
		}

		System.out.println(answer);

	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] line = br.readLine().split(""); line br.readLine().split("") br.readLine().split br.readLine() br.readLine br "" String answer = ""; answer "" for (int i = 0; i < line.length; i++) {
			switch (line[i]) {
			case "0":
			case "1":
				answer = answer + line[i];
				break;
			case "B":
				if (!(answer.equals(""))) {
					answer = answer.substring(0, answer.length() - 1);

				}
			}
		} int i = 0; int i = 0; i 0 i < line.length i line.length line line.length i++ i++ i {
			switch (line[i]) {
			case "0":
			case "1":
				answer = answer + line[i];
				break;
			case "B":
				if (!(answer.equals(""))) {
					answer = answer.substring(0, answer.length() - 1);

				}
			}
		} {
			switch (line[i]) {
			case "0":
			case "1":
				answer = answer + line[i];
				break;
			case "B":
				if (!(answer.equals(""))) {
					answer = answer.substring(0, answer.length() - 1);

				}
			}
		} switch (line[i]) {
			case "0":
			case "1":
				answer = answer + line[i];
				break;
			case "B":
				if (!(answer.equals(""))) {
					answer = answer.substring(0, answer.length() - 1);

				}
			} line[i] line i case "0": "0" case "0": case "1": "1" case "1": answer = answer + line[i] answer answer + line[i] answer line[i] line i break; case "B": "B" case "B": if (!(answer.equals(""))) {
					answer = answer.substring(0, answer.length() - 1);

				} !(answer.equals("")) (answer.equals("")) answer.equals answer "" {
					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) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split("");
		String answer = "";

		for (int i = 0; i < line.length; i++) {
			switch (line[i]) {
			case "0":
			case "1":
				answer = answer + line[i];
				break;
			case "B":
				if (!(answer.equals(""))) {
					answer = answer.substring(0, answer.length() - 1);

				}
			}
		}

		System.out.println(answer);

	}
} public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split("");
		String answer = "";

		for (int i = 0; i < line.length; i++) {
			switch (line[i]) {
			case "0":
			case "1":
				answer = answer + line[i];
				break;
			case "B":
				if (!(answer.equals(""))) {
					answer = answer.substring(0, answer.length() - 1);

				}
			}
		}

		System.out.println(answer);

	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split("");
		String answer = "";

		for (int i = 0; i < line.length; i++) {
			switch (line[i]) {
			case "0":
			case "1":
				answer = answer + line[i];
				break;
			case "B":
				if (!(answer.equals(""))) {
					answer = answer.substring(0, answer.length() - 1);

				}
			}
		}

		System.out.println(answer);

	}
}
