import java.util.Scanner;

public class Main {

	public static void main (String[] args) {
		Scanner scan = new Scanner(System.in);
		String[] s = scan.next().split("");
		String result ="";
		for(String w:s) {
			if(w.equals("0") || w.equals("1")) result+=w;
			if(w.equals("B") && result.length()>0)result = result.substring(0, result.length()-1);
		}
		System.out.println(result);
	}

} 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.next().split("");
		String result ="";
		for(String w:s) {
			if(w.equals("0") || w.equals("1")) result+=w;
			if(w.equals("B") && result.length()>0)result = result.substring(0, result.length()-1);
		}
		System.out.println(result);
	}

} Main public static void main (String[] args) {
		Scanner scan = new Scanner(System.in);
		String[] s = scan.next().split("");
		String result ="";
		for(String w:s) {
			if(w.equals("0") || w.equals("1")) result+=w;
			if(w.equals("B") && result.length()>0)result = result.substring(0, result.length()-1);
		}
		System.out.println(result);
	} main {
		Scanner scan = new Scanner(System.in);
		String[] s = scan.next().split("");
		String result ="";
		for(String w:s) {
			if(w.equals("0") || w.equals("1")) result+=w;
			if(w.equals("B") && result.length()>0)result = result.substring(0, result.length()-1);
		}
		System.out.println(result);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String[] s = scan.next().split(""); s scan.next().split("") scan.next().split scan.next() scan.next scan "" String result =""; result "" for(String w:s) {
			if(w.equals("0") || w.equals("1")) result+=w;
			if(w.equals("B") && result.length()>0)result = result.substring(0, result.length()-1);
		} String w s {
			if(w.equals("0") || w.equals("1")) result+=w;
			if(w.equals("B") && result.length()>0)result = result.substring(0, result.length()-1);
		} {
			if(w.equals("0") || w.equals("1")) result+=w;
			if(w.equals("B") && result.length()>0)result = result.substring(0, result.length()-1);
		} if(w.equals("0") || w.equals("1")) result+=w; w.equals("0") || w.equals("1") w.equals("0") w.equals w "0" w.equals("1") w.equals w "1" result+=w result w if(w.equals("B") && result.length()>0)result = result.substring(0, result.length()-1); w.equals("B") && result.length()>0 w.equals("B") w.equals w "B" result.length()>0 result.length() result.length result 0 result = result.substring(0, result.length()-1) result result.substring(0, result.length()-1) result.substring result 0 result.length()-1 result.length() result.length result 1 System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

	public static void main (String[] args) {
		Scanner scan = new Scanner(System.in);
		String[] s = scan.next().split("");
		String result ="";
		for(String w:s) {
			if(w.equals("0") || w.equals("1")) result+=w;
			if(w.equals("B") && result.length()>0)result = result.substring(0, result.length()-1);
		}
		System.out.println(result);
	}

} public class Main {

	public static void main (String[] args) {
		Scanner scan = new Scanner(System.in);
		String[] s = scan.next().split("");
		String result ="";
		for(String w:s) {
			if(w.equals("0") || w.equals("1")) result+=w;
			if(w.equals("B") && result.length()>0)result = result.substring(0, result.length()-1);
		}
		System.out.println(result);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main (String[] args) {
		Scanner scan = new Scanner(System.in);
		String[] s = scan.next().split("");
		String result ="";
		for(String w:s) {
			if(w.equals("0") || w.equals("1")) result+=w;
			if(w.equals("B") && result.length()>0)result = result.substring(0, result.length()-1);
		}
		System.out.println(result);
	}

}