import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String a=scan.next();
		int count=0;
		int ans[]=new int[a.length()];
		Arrays.fill(ans,-1);
		for(int i=0;i!=a.length();i++) {
			char b=a.charAt(i);
			if(b=='0') {
				ans[count]=0;
				count++;
			}if(b=='1') {
				ans[count]=1;
				count++;
			}
			if(b=='B'){
				count--;
				if(count<0) {
					count=0;
				}
				ans[count]=-1;
			}
			if(count<0) {
				count=0;
			}
		}
		for(int i=0;i!=a.length();i++) {
			if(ans[i]==-1) {
				break;
			}
			System.out.print(ans[i]);
		}
		System.out.println();
		
	}
	} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String a=scan.next();
		int count=0;
		int ans[]=new int[a.length()];
		Arrays.fill(ans,-1);
		for(int i=0;i!=a.length();i++) {
			char b=a.charAt(i);
			if(b=='0') {
				ans[count]=0;
				count++;
			}if(b=='1') {
				ans[count]=1;
				count++;
			}
			if(b=='B'){
				count--;
				if(count<0) {
					count=0;
				}
				ans[count]=-1;
			}
			if(count<0) {
				count=0;
			}
		}
		for(int i=0;i!=a.length();i++) {
			if(ans[i]==-1) {
				break;
			}
			System.out.print(ans[i]);
		}
		System.out.println();
		
	}
	} Main public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String a=scan.next();
		int count=0;
		int ans[]=new int[a.length()];
		Arrays.fill(ans,-1);
		for(int i=0;i!=a.length();i++) {
			char b=a.charAt(i);
			if(b=='0') {
				ans[count]=0;
				count++;
			}if(b=='1') {
				ans[count]=1;
				count++;
			}
			if(b=='B'){
				count--;
				if(count<0) {
					count=0;
				}
				ans[count]=-1;
			}
			if(count<0) {
				count=0;
			}
		}
		for(int i=0;i!=a.length();i++) {
			if(ans[i]==-1) {
				break;
			}
			System.out.print(ans[i]);
		}
		System.out.println();
		
	} main {
		Scanner scan=new Scanner(System.in);
		String a=scan.next();
		int count=0;
		int ans[]=new int[a.length()];
		Arrays.fill(ans,-1);
		for(int i=0;i!=a.length();i++) {
			char b=a.charAt(i);
			if(b=='0') {
				ans[count]=0;
				count++;
			}if(b=='1') {
				ans[count]=1;
				count++;
			}
			if(b=='B'){
				count--;
				if(count<0) {
					count=0;
				}
				ans[count]=-1;
			}
			if(count<0) {
				count=0;
			}
		}
		for(int i=0;i!=a.length();i++) {
			if(ans[i]==-1) {
				break;
			}
			System.out.print(ans[i]);
		}
		System.out.println();
		
	} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) String a=scan.next(); a scan.next() scan.next scan int count=0; count 0 int ans[]=new int[a.length()]; ans new int[a.length()] a.length() a.length a Arrays.fill(ans,-1) Arrays.fill Arrays ans -1 1 for(int i=0;i!=a.length();i++) {
			char b=a.charAt(i);
			if(b=='0') {
				ans[count]=0;
				count++;
			}if(b=='1') {
				ans[count]=1;
				count++;
			}
			if(b=='B'){
				count--;
				if(count<0) {
					count=0;
				}
				ans[count]=-1;
			}
			if(count<0) {
				count=0;
			}
		} int i=0; int i=0; i 0 i!=a.length() i a.length() a.length a i++ i++ i {
			char b=a.charAt(i);
			if(b=='0') {
				ans[count]=0;
				count++;
			}if(b=='1') {
				ans[count]=1;
				count++;
			}
			if(b=='B'){
				count--;
				if(count<0) {
					count=0;
				}
				ans[count]=-1;
			}
			if(count<0) {
				count=0;
			}
		} {
			char b=a.charAt(i);
			if(b=='0') {
				ans[count]=0;
				count++;
			}if(b=='1') {
				ans[count]=1;
				count++;
			}
			if(b=='B'){
				count--;
				if(count<0) {
					count=0;
				}
				ans[count]=-1;
			}
			if(count<0) {
				count=0;
			}
		} char b=a.charAt(i); b a.charAt(i) a.charAt a i if(b=='0') {
				ans[count]=0;
				count++;
			} b=='0' b '0' {
				ans[count]=0;
				count++;
			} ans[count]=0 ans[count] ans count 0 count++ count if(b=='1') {
				ans[count]=1;
				count++;
			} b=='1' b '1' {
				ans[count]=1;
				count++;
			} ans[count]=1 ans[count] ans count 1 count++ count if(b=='B'){
				count--;
				if(count<0) {
					count=0;
				}
				ans[count]=-1;
			} b=='B' b 'B' {
				count--;
				if(count<0) {
					count=0;
				}
				ans[count]=-1;
			} count-- count if(count<0) {
					count=0;
				} count<0 count 0 {
					count=0;
				} count=0 count 0 ans[count]=-1 ans[count] ans count -1 1 if(count<0) {
				count=0;
			} count<0 count 0 {
				count=0;
			} count=0 count 0 for(int i=0;i!=a.length();i++) {
			if(ans[i]==-1) {
				break;
			}
			System.out.print(ans[i]);
		} int i=0; int i=0; i 0 i!=a.length() i a.length() a.length a i++ i++ i {
			if(ans[i]==-1) {
				break;
			}
			System.out.print(ans[i]);
		} {
			if(ans[i]==-1) {
				break;
			}
			System.out.print(ans[i]);
		} if(ans[i]==-1) {
				break;
			} ans[i]==-1 ans[i] ans i -1 1 {
				break;
			} break; System.out.print(ans[i]) System.out.print System.out System System.out ans[i] ans i System.out.println() System.out.println System.out System System.out String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String a=scan.next();
		int count=0;
		int ans[]=new int[a.length()];
		Arrays.fill(ans,-1);
		for(int i=0;i!=a.length();i++) {
			char b=a.charAt(i);
			if(b=='0') {
				ans[count]=0;
				count++;
			}if(b=='1') {
				ans[count]=1;
				count++;
			}
			if(b=='B'){
				count--;
				if(count<0) {
					count=0;
				}
				ans[count]=-1;
			}
			if(count<0) {
				count=0;
			}
		}
		for(int i=0;i!=a.length();i++) {
			if(ans[i]==-1) {
				break;
			}
			System.out.print(ans[i]);
		}
		System.out.println();
		
	}
	} public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String a=scan.next();
		int count=0;
		int ans[]=new int[a.length()];
		Arrays.fill(ans,-1);
		for(int i=0;i!=a.length();i++) {
			char b=a.charAt(i);
			if(b=='0') {
				ans[count]=0;
				count++;
			}if(b=='1') {
				ans[count]=1;
				count++;
			}
			if(b=='B'){
				count--;
				if(count<0) {
					count=0;
				}
				ans[count]=-1;
			}
			if(count<0) {
				count=0;
			}
		}
		for(int i=0;i!=a.length();i++) {
			if(ans[i]==-1) {
				break;
			}
			System.out.print(ans[i]);
		}
		System.out.println();
		
	}
	} Main
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String a=scan.next();
		int count=0;
		int ans[]=new int[a.length()];
		Arrays.fill(ans,-1);
		for(int i=0;i!=a.length();i++) {
			char b=a.charAt(i);
			if(b=='0') {
				ans[count]=0;
				count++;
			}if(b=='1') {
				ans[count]=1;
				count++;
			}
			if(b=='B'){
				count--;
				if(count<0) {
					count=0;
				}
				ans[count]=-1;
			}
			if(count<0) {
				count=0;
			}
		}
		for(int i=0;i!=a.length();i++) {
			if(ans[i]==-1) {
				break;
			}
			System.out.print(ans[i]);
		}
		System.out.println();
		
	}
	}