import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		StringBuilder sb = new StringBuilder("");

		String n = s.nextLine();
		int na = n.length();
		int i = 0;

		for (i = 0; i < na; i++) {
			String a = n.charAt(i) + "";
			if (a.equals("0")) {
				sb.append("0");
			} else if (a.equals("1")) {
				sb.append("1");
			} else if (a.equals("B")) {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			}
		}

		System.out.println(sb);

	}

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

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		StringBuilder sb = new StringBuilder("");

		String n = s.nextLine();
		int na = n.length();
		int i = 0;

		for (i = 0; i < na; i++) {
			String a = n.charAt(i) + "";
			if (a.equals("0")) {
				sb.append("0");
			} else if (a.equals("1")) {
				sb.append("1");
			} else if (a.equals("B")) {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			}
		}

		System.out.println(sb);

	}

} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		StringBuilder sb = new StringBuilder("");

		String n = s.nextLine();
		int na = n.length();
		int i = 0;

		for (i = 0; i < na; i++) {
			String a = n.charAt(i) + "";
			if (a.equals("0")) {
				sb.append("0");
			} else if (a.equals("1")) {
				sb.append("1");
			} else if (a.equals("B")) {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			}
		}

		System.out.println(sb);

	} main {
		Scanner s = new Scanner(System.in);
		StringBuilder sb = new StringBuilder("");

		String n = s.nextLine();
		int na = n.length();
		int i = 0;

		for (i = 0; i < na; i++) {
			String a = n.charAt(i) + "";
			if (a.equals("0")) {
				sb.append("0");
			} else if (a.equals("1")) {
				sb.append("1");
			} else if (a.equals("B")) {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			}
		}

		System.out.println(sb);

	} Scanner s = new Scanner(System.in); s new Scanner(System.in) StringBuilder sb = new StringBuilder(""); sb new StringBuilder("") String n = s.nextLine(); n s.nextLine() s.nextLine s int na = n.length(); na n.length() n.length n int i = 0; i 0 for (i = 0; i < na; i++) {
			String a = n.charAt(i) + "";
			if (a.equals("0")) {
				sb.append("0");
			} else if (a.equals("1")) {
				sb.append("1");
			} else if (a.equals("B")) {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			}
		} i = 0; i = 0 i 0 i < na i na i++ i++ i {
			String a = n.charAt(i) + "";
			if (a.equals("0")) {
				sb.append("0");
			} else if (a.equals("1")) {
				sb.append("1");
			} else if (a.equals("B")) {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			}
		} {
			String a = n.charAt(i) + "";
			if (a.equals("0")) {
				sb.append("0");
			} else if (a.equals("1")) {
				sb.append("1");
			} else if (a.equals("B")) {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			}
		} String a = n.charAt(i) + ""; a n.charAt(i) + "" n.charAt(i) n.charAt n i "" if (a.equals("0")) {
				sb.append("0");
			} else if (a.equals("1")) {
				sb.append("1");
			} else if (a.equals("B")) {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			} a.equals("0") a.equals a "0" {
				sb.append("0");
			} sb.append("0") sb.append sb "0" if (a.equals("1")) {
				sb.append("1");
			} else if (a.equals("B")) {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			} a.equals("1") a.equals a "1" {
				sb.append("1");
			} sb.append("1") sb.append sb "1" if (a.equals("B")) {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			} a.equals("B") a.equals a "B" {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			} if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				} sb.length()==0 sb.length() sb.length sb 0 {
					sb.append("");
				} sb.append("") sb.append sb "" {
					sb.deleteCharAt(sb.length() - 1);
				} sb.deleteCharAt(sb.length() - 1) sb.deleteCharAt sb sb.length() - 1 sb.length() sb.length sb 1 System.out.println(sb) System.out.println System.out System System.out sb String[] args args public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		StringBuilder sb = new StringBuilder("");

		String n = s.nextLine();
		int na = n.length();
		int i = 0;

		for (i = 0; i < na; i++) {
			String a = n.charAt(i) + "";
			if (a.equals("0")) {
				sb.append("0");
			} else if (a.equals("1")) {
				sb.append("1");
			} else if (a.equals("B")) {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			}
		}

		System.out.println(sb);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		StringBuilder sb = new StringBuilder("");

		String n = s.nextLine();
		int na = n.length();
		int i = 0;

		for (i = 0; i < na; i++) {
			String a = n.charAt(i) + "";
			if (a.equals("0")) {
				sb.append("0");
			} else if (a.equals("1")) {
				sb.append("1");
			} else if (a.equals("B")) {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			}
		}

		System.out.println(sb);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		StringBuilder sb = new StringBuilder("");

		String n = s.nextLine();
		int na = n.length();
		int i = 0;

		for (i = 0; i < na; i++) {
			String a = n.charAt(i) + "";
			if (a.equals("0")) {
				sb.append("0");
			} else if (a.equals("1")) {
				sb.append("1");
			} else if (a.equals("B")) {
				if (sb.length()==0) {
					sb.append("");
				} else {
					sb.deleteCharAt(sb.length() - 1);
				}
			}
		}

		System.out.println(sb);

	}

}