import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String s = scan.nextLine();

		//System.out.println(s);
		StringBuilder ss = new StringBuilder("");

		int nagasa = s.length();
		int a = 0;
		int i = 0;
		int b=ss.length();

		for (i = 0; i < nagasa; i++) {

			char c1 = s.charAt(i);
			String str = String.valueOf(c1);

			if (str.equals("1")) {

				ss = ss.append("1");

			}else if (str.equals("0")) {

				ss = ss.append("0");

			}else if (str.equals("B")) {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			}
			//System.out.println(ss);
		}

		System.out.println(ss);

	}

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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String s = scan.nextLine();

		//System.out.println(s);
		StringBuilder ss = new StringBuilder("");

		int nagasa = s.length();
		int a = 0;
		int i = 0;
		int b=ss.length();

		for (i = 0; i < nagasa; i++) {

			char c1 = s.charAt(i);
			String str = String.valueOf(c1);

			if (str.equals("1")) {

				ss = ss.append("1");

			}else if (str.equals("0")) {

				ss = ss.append("0");

			}else if (str.equals("B")) {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			}
			//System.out.println(ss);
		}

		System.out.println(ss);

	}

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

		String s = scan.nextLine();

		//System.out.println(s);
		StringBuilder ss = new StringBuilder("");

		int nagasa = s.length();
		int a = 0;
		int i = 0;
		int b=ss.length();

		for (i = 0; i < nagasa; i++) {

			char c1 = s.charAt(i);
			String str = String.valueOf(c1);

			if (str.equals("1")) {

				ss = ss.append("1");

			}else if (str.equals("0")) {

				ss = ss.append("0");

			}else if (str.equals("B")) {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			}
			//System.out.println(ss);
		}

		System.out.println(ss);

	} main {
		Scanner scan = new Scanner(System.in);

		String s = scan.nextLine();

		//System.out.println(s);
		StringBuilder ss = new StringBuilder("");

		int nagasa = s.length();
		int a = 0;
		int i = 0;
		int b=ss.length();

		for (i = 0; i < nagasa; i++) {

			char c1 = s.charAt(i);
			String str = String.valueOf(c1);

			if (str.equals("1")) {

				ss = ss.append("1");

			}else if (str.equals("0")) {

				ss = ss.append("0");

			}else if (str.equals("B")) {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			}
			//System.out.println(ss);
		}

		System.out.println(ss);

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.nextLine(); s scan.nextLine() scan.nextLine scan StringBuilder ss = new StringBuilder(""); ss new StringBuilder("") int nagasa = s.length(); nagasa s.length() s.length s int a = 0; a 0 int i = 0; i 0 int b=ss.length(); b ss.length() ss.length ss for (i = 0; i < nagasa; i++) {

			char c1 = s.charAt(i);
			String str = String.valueOf(c1);

			if (str.equals("1")) {

				ss = ss.append("1");

			}else if (str.equals("0")) {

				ss = ss.append("0");

			}else if (str.equals("B")) {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			}
			//System.out.println(ss);
		} i = 0; i = 0 i 0 i < nagasa i nagasa i++ i++ i {

			char c1 = s.charAt(i);
			String str = String.valueOf(c1);

			if (str.equals("1")) {

				ss = ss.append("1");

			}else if (str.equals("0")) {

				ss = ss.append("0");

			}else if (str.equals("B")) {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			}
			//System.out.println(ss);
		} {

			char c1 = s.charAt(i);
			String str = String.valueOf(c1);

			if (str.equals("1")) {

				ss = ss.append("1");

			}else if (str.equals("0")) {

				ss = ss.append("0");

			}else if (str.equals("B")) {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			}
			//System.out.println(ss);
		} char c1 = s.charAt(i); c1 s.charAt(i) s.charAt s i String str = String.valueOf(c1); str String.valueOf(c1) String.valueOf String c1 if (str.equals("1")) {

				ss = ss.append("1");

			}else if (str.equals("0")) {

				ss = ss.append("0");

			}else if (str.equals("B")) {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			} str.equals("1") str.equals str "1" {

				ss = ss.append("1");

			} ss = ss.append("1") ss ss.append("1") ss.append ss "1" if (str.equals("0")) {

				ss = ss.append("0");

			}else if (str.equals("B")) {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			} str.equals("0") str.equals str "0" {

				ss = ss.append("0");

			} ss = ss.append("0") ss ss.append("0") ss.append ss "0" if (str.equals("B")) {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			} str.equals("B") str.equals str "B" {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			} if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				} ss.length()==0 ss.length() ss.length ss 0 {

				} {
					ss = ss.deleteCharAt(ss.length()-1);

				} ss = ss.deleteCharAt(ss.length()-1) ss ss.deleteCharAt(ss.length()-1) ss.deleteCharAt ss ss.length()-1 ss.length() ss.length ss 1 System.out.println(ss) System.out.println System.out System System.out ss String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String s = scan.nextLine();

		//System.out.println(s);
		StringBuilder ss = new StringBuilder("");

		int nagasa = s.length();
		int a = 0;
		int i = 0;
		int b=ss.length();

		for (i = 0; i < nagasa; i++) {

			char c1 = s.charAt(i);
			String str = String.valueOf(c1);

			if (str.equals("1")) {

				ss = ss.append("1");

			}else if (str.equals("0")) {

				ss = ss.append("0");

			}else if (str.equals("B")) {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			}
			//System.out.println(ss);
		}

		System.out.println(ss);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String s = scan.nextLine();

		//System.out.println(s);
		StringBuilder ss = new StringBuilder("");

		int nagasa = s.length();
		int a = 0;
		int i = 0;
		int b=ss.length();

		for (i = 0; i < nagasa; i++) {

			char c1 = s.charAt(i);
			String str = String.valueOf(c1);

			if (str.equals("1")) {

				ss = ss.append("1");

			}else if (str.equals("0")) {

				ss = ss.append("0");

			}else if (str.equals("B")) {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			}
			//System.out.println(ss);
		}

		System.out.println(ss);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String s = scan.nextLine();

		//System.out.println(s);
		StringBuilder ss = new StringBuilder("");

		int nagasa = s.length();
		int a = 0;
		int i = 0;
		int b=ss.length();

		for (i = 0; i < nagasa; i++) {

			char c1 = s.charAt(i);
			String str = String.valueOf(c1);

			if (str.equals("1")) {

				ss = ss.append("1");

			}else if (str.equals("0")) {

				ss = ss.append("0");

			}else if (str.equals("B")) {

				if(ss.length()==0) {

				}else {
					ss = ss.deleteCharAt(ss.length()-1);

				}
			}
			//System.out.println(ss);
		}

		System.out.println(ss);

	}

}