import java.io.*;
import java.math.*;
import java.util.*;
public class Main { //CASH MONEY --> Collections.sort()>>>>>Arrays.sort()
 
	public static void main(String[] args) { //Ball out dawg
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		String S = I.next();
		Stack<Character> cur = new Stack<Character>();
		Stack<Character> ans = new Stack<Character>();
		for (int i = 0; i < S.length(); i++) {
			if (S.charAt(i)=='1') cur.push('1');
			else if (S.charAt(i)=='0') cur.push('0');
			else if (S.charAt(i)=='B'&&cur.size()>0) cur.pop();
		}
		while (!cur.isEmpty()) {
			ans.add(cur.pop());
		}
		while (!ans.isEmpty()) O.p(ans.pop());
	}
	public static int MEX(int N,int[] cnts) {
		for (int test = 0; test <=N; test++) if (cnts[test]==0) return test;
		return -1;
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
}
 import java.io.*; io.* java import java.math.*; math.* java import java.util.*; util.* java public class Main { //CASH MONEY --> Collections.sort()>>>>>Arrays.sort()
 
	public static void main(String[] args) { //Ball out dawg
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		String S = I.next();
		Stack<Character> cur = new Stack<Character>();
		Stack<Character> ans = new Stack<Character>();
		for (int i = 0; i < S.length(); i++) {
			if (S.charAt(i)=='1') cur.push('1');
			else if (S.charAt(i)=='0') cur.push('0');
			else if (S.charAt(i)=='B'&&cur.size()>0) cur.pop();
		}
		while (!cur.isEmpty()) {
			ans.add(cur.pop());
		}
		while (!ans.isEmpty()) O.p(ans.pop());
	}
	public static int MEX(int N,int[] cnts) {
		for (int test = 0; test <=N; test++) if (cnts[test]==0) return test;
		return -1;
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
} Main public static void main(String[] args) { //Ball out dawg
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		String S = I.next();
		Stack<Character> cur = new Stack<Character>();
		Stack<Character> ans = new Stack<Character>();
		for (int i = 0; i < S.length(); i++) {
			if (S.charAt(i)=='1') cur.push('1');
			else if (S.charAt(i)=='0') cur.push('0');
			else if (S.charAt(i)=='B'&&cur.size()>0) cur.pop();
		}
		while (!cur.isEmpty()) {
			ans.add(cur.pop());
		}
		while (!ans.isEmpty()) O.p(ans.pop());
	} main { //Ball out dawg
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		String S = I.next();
		Stack<Character> cur = new Stack<Character>();
		Stack<Character> ans = new Stack<Character>();
		for (int i = 0; i < S.length(); i++) {
			if (S.charAt(i)=='1') cur.push('1');
			else if (S.charAt(i)=='0') cur.push('0');
			else if (S.charAt(i)=='B'&&cur.size()>0) cur.pop();
		}
		while (!cur.isEmpty()) {
			ans.add(cur.pop());
		}
		while (!ans.isEmpty()) O.p(ans.pop());
	} FastScanner I = new FastScanner(); I new FastScanner() OutPut O = new OutPut(); O new OutPut() String S = I.next(); S I.next() I.next I Stack<Character> cur = new Stack<Character>(); cur new Stack<Character>() Stack<Character> ans = new Stack<Character>(); ans new Stack<Character>() for (int i = 0; i < S.length(); i++) {
			if (S.charAt(i)=='1') cur.push('1');
			else if (S.charAt(i)=='0') cur.push('0');
			else if (S.charAt(i)=='B'&&cur.size()>0) cur.pop();
		} int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
			if (S.charAt(i)=='1') cur.push('1');
			else if (S.charAt(i)=='0') cur.push('0');
			else if (S.charAt(i)=='B'&&cur.size()>0) cur.pop();
		} {
			if (S.charAt(i)=='1') cur.push('1');
			else if (S.charAt(i)=='0') cur.push('0');
			else if (S.charAt(i)=='B'&&cur.size()>0) cur.pop();
		} if (S.charAt(i)=='1') cur.push('1');
			else if (S.charAt(i)=='0') cur.push('0');
			else if (S.charAt(i)=='B'&&cur.size()>0) cur.pop(); S.charAt(i)=='1' S.charAt(i) S.charAt S i '1' cur.push('1') cur.push cur '1' if (S.charAt(i)=='0') cur.push('0');
			else if (S.charAt(i)=='B'&&cur.size()>0) cur.pop(); S.charAt(i)=='0' S.charAt(i) S.charAt S i '0' cur.push('0') cur.push cur '0' if (S.charAt(i)=='B'&&cur.size()>0) cur.pop(); S.charAt(i)=='B'&&cur.size()>0 S.charAt(i)=='B' S.charAt(i) S.charAt S i 'B' cur.size()>0 cur.size() cur.size cur 0 cur.pop() cur.pop cur while (!cur.isEmpty()) {
			ans.add(cur.pop());
		} !cur.isEmpty() cur.isEmpty() cur.isEmpty cur {
			ans.add(cur.pop());
		} ans.add(cur.pop()) ans.add ans cur.pop() cur.pop cur while (!ans.isEmpty()) O.p(ans.pop()); !ans.isEmpty() ans.isEmpty() ans.isEmpty ans O.p(ans.pop()) O.p O ans.pop() ans.pop ans String[] args args public static int MEX(int N,int[] cnts) {
		for (int test = 0; test <=N; test++) if (cnts[test]==0) return test;
		return -1;
	} MEX {
		for (int test = 0; test <=N; test++) if (cnts[test]==0) return test;
		return -1;
	} for (int test = 0; test <=N; test++) if (cnts[test]==0) return test; int test = 0; int test = 0; test 0 test <=N test N test++ test++ test if (cnts[test]==0) return test; if (cnts[test]==0) return test; cnts[test]==0 cnts[test] cnts test 0 return test; test return -1; -1 1 int N N int[] cnts cnts public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;} ceil {long ans = num/den; if (num%den!=0) 
	ans++; return ans;} long ans = num/den; ans num/den num den if (num%den!=0) 
	ans++; num%den!=0 num%den num den 0 ans++ ans return ans; ans long num num long den den public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	} GCD {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	} if (a==0||b==0) return Math.max(a,b); a==0||b==0 a==0 a 0 b==0 b 0 return Math.max(a,b); Math.max(a,b) Math.max Math a b return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b)); GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b)) GCD Math.min(a, b) Math.min Math a b Math.max(a, b)%Math.min(a, b) Math.max(a, b) Math.max Math a b Math.min(a, b) Math.min Math a b long a a long b b public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	} FastExp {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	} long ans=1; ans 1 while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		} exp>0 exp 0 {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		} if (exp%2==1) ans*=base; exp%2==1 exp%2 exp 2 1 ans*=base ans base exp/=2 exp 2 base*=base base base base%=mod base mod ans%=mod ans mod return ans; ans long base base long exp exp long mod mod public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);} ModInv {return FastExp(num,mod-2,mod);} return FastExp(num,mod-2,mod); FastExp(num,mod-2,mod) FastExp num mod-2 mod 2 mod long num num long mod mod static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	} FastScanner BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st=new StringTokenizer(""); st new StringTokenizer("") String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		} next {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		} while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				} !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				} catch (IOException e) {
					e.printStackTrace();
				} IOException e {
					e.printStackTrace();
				} e.printStackTrace() e.printStackTrace e {
					st=new StringTokenizer(br.readLine());
				} st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() {return Integer.parseInt(next());} nextInt {return Integer.parseInt(next());} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() {return Long.parseLong(next());} nextLong {return Long.parseLong(next());} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	} OutPut PrintWriter w = new PrintWriter(System.out); w new PrintWriter(System.out) void pln(int x) {w.println(x);w.flush();} pln {w.println(x);w.flush();} w.println(x) w.println w x w.flush() w.flush w int x x void pln(long x) {w.println(x);w.flush();} pln {w.println(x);w.flush();} w.println(x) w.println w x w.flush() w.flush w long x x void pln(String x) {w.println(x);w.flush();} pln {w.println(x);w.flush();} w.println(x) w.println w x w.flush() w.flush w String x x void pln(char x) {w.println(x);w.flush();} pln {w.println(x);w.flush();} w.println(x) w.println w x w.flush() w.flush w char x x void pln(StringBuilder x) {w.println(x);w.flush();} pln {w.println(x);w.flush();} w.println(x) w.println w x w.flush() w.flush w StringBuilder x x void p(int x) {w.print(x);w.flush();} p {w.print(x);w.flush();} w.print(x) w.print w x w.flush() w.flush w int x x void p(long x) {w.print(x);w.flush();} p {w.print(x);w.flush();} w.print(x) w.print w x w.flush() w.flush w long x x void p(String x) {w.print(x);w.flush();} p {w.print(x);w.flush();} w.print(x) w.print w x w.flush() w.flush w String x x void p(char x) {w.print(x);w.flush();} p {w.print(x);w.flush();} w.print(x) w.print w x w.flush() w.flush w char x x void p(StringBuilder x) {w.print(x);w.flush();} p {w.print(x);w.flush();} w.print(x) w.print w x w.flush() w.flush w StringBuilder x x public class Main { //CASH MONEY --> Collections.sort()>>>>>Arrays.sort()
 
	public static void main(String[] args) { //Ball out dawg
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		String S = I.next();
		Stack<Character> cur = new Stack<Character>();
		Stack<Character> ans = new Stack<Character>();
		for (int i = 0; i < S.length(); i++) {
			if (S.charAt(i)=='1') cur.push('1');
			else if (S.charAt(i)=='0') cur.push('0');
			else if (S.charAt(i)=='B'&&cur.size()>0) cur.pop();
		}
		while (!cur.isEmpty()) {
			ans.add(cur.pop());
		}
		while (!ans.isEmpty()) O.p(ans.pop());
	}
	public static int MEX(int N,int[] cnts) {
		for (int test = 0; test <=N; test++) if (cnts[test]==0) return test;
		return -1;
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
} public class Main { //CASH MONEY --> Collections.sort()>>>>>Arrays.sort()
 
	public static void main(String[] args) { //Ball out dawg
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		String S = I.next();
		Stack<Character> cur = new Stack<Character>();
		Stack<Character> ans = new Stack<Character>();
		for (int i = 0; i < S.length(); i++) {
			if (S.charAt(i)=='1') cur.push('1');
			else if (S.charAt(i)=='0') cur.push('0');
			else if (S.charAt(i)=='B'&&cur.size()>0) cur.pop();
		}
		while (!cur.isEmpty()) {
			ans.add(cur.pop());
		}
		while (!ans.isEmpty()) O.p(ans.pop());
	}
	public static int MEX(int N,int[] cnts) {
		for (int test = 0; test <=N; test++) if (cnts[test]==0) return test;
		return -1;
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
} Main
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { //CASH MONEY --> Collections.sort()>>>>>Arrays.sort()
 
	public static void main(String[] args) { //Ball out dawg
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		String S = I.next();
		Stack<Character> cur = new Stack<Character>();
		Stack<Character> ans = new Stack<Character>();
		for (int i = 0; i < S.length(); i++) {
			if (S.charAt(i)=='1') cur.push('1');
			else if (S.charAt(i)=='0') cur.push('0');
			else if (S.charAt(i)=='B'&&cur.size()>0) cur.pop();
		}
		while (!cur.isEmpty()) {
			ans.add(cur.pop());
		}
		while (!ans.isEmpty()) O.p(ans.pop());
	}
	public static int MEX(int N,int[] cnts) {
		for (int test = 0; test <=N; test++) if (cnts[test]==0) return test;
		return -1;
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
}

