import java.util.*;
import java.io.*;
import java.math.*;
class Main {

	public static void main(String[] args) {
		FastScanner I=new FastScanner();
		Output O=new 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.empty()) {
			ans.add(cur.pop());
		}
		while(!ans.empty()) {
			O.p(ans.pop());
		}
		
		System.out.println();
	}
	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.util.*; util.* java import java.io.*; io.* java import java.math.*; math.* java class Main {

	public static void main(String[] args) {
		FastScanner I=new FastScanner();
		Output O=new 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.empty()) {
			ans.add(cur.pop());
		}
		while(!ans.empty()) {
			O.p(ans.pop());
		}
		
		System.out.println();
	}
	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) {
		FastScanner I=new FastScanner();
		Output O=new 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.empty()) {
			ans.add(cur.pop());
		}
		while(!ans.empty()) {
			O.p(ans.pop());
		}
		
		System.out.println();
	} main {
		FastScanner I=new FastScanner();
		Output O=new 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.empty()) {
			ans.add(cur.pop());
		}
		while(!ans.empty()) {
			O.p(ans.pop());
		}
		
		System.out.println();
	} 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.empty()) {
			ans.add(cur.pop());
		} !cur.empty() cur.empty() cur.empty cur {
			ans.add(cur.pop());
		} ans.add(cur.pop()) ans.add ans cur.pop() cur.pop cur while(!ans.empty()) {
			O.p(ans.pop());
		} !ans.empty() ans.empty() ans.empty ans {
			O.p(ans.pop());
		} O.p(ans.pop()) O.p O ans.pop() ans.pop ans System.out.println() System.out.println System.out System System.out String[] args args 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
import java.util.*;
import java.io.*;
import java.math.*;
class Main {

	public static void main(String[] args) {
		FastScanner I=new FastScanner();
		Output O=new 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.empty()) {
			ans.add(cur.pop());
		}
		while(!ans.empty()) {
			O.p(ans.pop());
		}
		
		System.out.println();
	}
	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();}
	}
		
}
