import java.util.*;
 
class Main{
	public static void main(String[] args){
      String answer = "";
		Scanner scan = new Scanner(System.in);
      	String s = scan.next();
      	 int l = s.length();
     	 String[] moji = new String[l];
      for(int i = 0;i < l;i++){
        moji[i]=String.valueOf(s.charAt(i));
	}
      for(String moj : moji){
        boolean is0 = moj.equals("0");
        boolean is1 = moj.equals("1");
        boolean isB = moj.equals("B");
        boolean isAns0 = answer.length()==0;
        
        if(is0){
          answer += "0";
        }else if(is1){
          answer += "1";
        }else if(isB && !isAns0){
          String t = answer;
          answer = answer.substring(0,t.length()-1);
        }
      }
        System.out.println(answer);
}
} import java.util.*; util.* java class Main{
	public static void main(String[] args){
      String answer = "";
		Scanner scan = new Scanner(System.in);
      	String s = scan.next();
      	 int l = s.length();
     	 String[] moji = new String[l];
      for(int i = 0;i < l;i++){
        moji[i]=String.valueOf(s.charAt(i));
	}
      for(String moj : moji){
        boolean is0 = moj.equals("0");
        boolean is1 = moj.equals("1");
        boolean isB = moj.equals("B");
        boolean isAns0 = answer.length()==0;
        
        if(is0){
          answer += "0";
        }else if(is1){
          answer += "1";
        }else if(isB && !isAns0){
          String t = answer;
          answer = answer.substring(0,t.length()-1);
        }
      }
        System.out.println(answer);
}
} Main public static void main(String[] args){
      String answer = "";
		Scanner scan = new Scanner(System.in);
      	String s = scan.next();
      	 int l = s.length();
     	 String[] moji = new String[l];
      for(int i = 0;i < l;i++){
        moji[i]=String.valueOf(s.charAt(i));
	}
      for(String moj : moji){
        boolean is0 = moj.equals("0");
        boolean is1 = moj.equals("1");
        boolean isB = moj.equals("B");
        boolean isAns0 = answer.length()==0;
        
        if(is0){
          answer += "0";
        }else if(is1){
          answer += "1";
        }else if(isB && !isAns0){
          String t = answer;
          answer = answer.substring(0,t.length()-1);
        }
      }
        System.out.println(answer);
} main {
      String answer = "";
		Scanner scan = new Scanner(System.in);
      	String s = scan.next();
      	 int l = s.length();
     	 String[] moji = new String[l];
      for(int i = 0;i < l;i++){
        moji[i]=String.valueOf(s.charAt(i));
	}
      for(String moj : moji){
        boolean is0 = moj.equals("0");
        boolean is1 = moj.equals("1");
        boolean isB = moj.equals("B");
        boolean isAns0 = answer.length()==0;
        
        if(is0){
          answer += "0";
        }else if(is1){
          answer += "1";
        }else if(isB && !isAns0){
          String t = answer;
          answer = answer.substring(0,t.length()-1);
        }
      }
        System.out.println(answer);
} String answer = ""; answer "" Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan int l = s.length(); l s.length() s.length s String[] moji = new String[l]; moji new String[l] l for(int i = 0;i < l;i++){
        moji[i]=String.valueOf(s.charAt(i));
	} int i = 0; int i = 0; i 0 i < l i l i++ i++ i {
        moji[i]=String.valueOf(s.charAt(i));
	} {
        moji[i]=String.valueOf(s.charAt(i));
	} moji[i]=String.valueOf(s.charAt(i)) moji[i] moji i String.valueOf(s.charAt(i)) String.valueOf String s.charAt(i) s.charAt s i for(String moj : moji){
        boolean is0 = moj.equals("0");
        boolean is1 = moj.equals("1");
        boolean isB = moj.equals("B");
        boolean isAns0 = answer.length()==0;
        
        if(is0){
          answer += "0";
        }else if(is1){
          answer += "1";
        }else if(isB && !isAns0){
          String t = answer;
          answer = answer.substring(0,t.length()-1);
        }
      } String moj moji {
        boolean is0 = moj.equals("0");
        boolean is1 = moj.equals("1");
        boolean isB = moj.equals("B");
        boolean isAns0 = answer.length()==0;
        
        if(is0){
          answer += "0";
        }else if(is1){
          answer += "1";
        }else if(isB && !isAns0){
          String t = answer;
          answer = answer.substring(0,t.length()-1);
        }
      } {
        boolean is0 = moj.equals("0");
        boolean is1 = moj.equals("1");
        boolean isB = moj.equals("B");
        boolean isAns0 = answer.length()==0;
        
        if(is0){
          answer += "0";
        }else if(is1){
          answer += "1";
        }else if(isB && !isAns0){
          String t = answer;
          answer = answer.substring(0,t.length()-1);
        }
      } boolean is0 = moj.equals("0"); is0 moj.equals("0") moj.equals moj "0" boolean is1 = moj.equals("1"); is1 moj.equals("1") moj.equals moj "1" boolean isB = moj.equals("B"); isB moj.equals("B") moj.equals moj "B" boolean isAns0 = answer.length()==0; isAns0 answer.length()==0 answer.length() answer.length answer 0 if(is0){
          answer += "0";
        }else if(is1){
          answer += "1";
        }else if(isB && !isAns0){
          String t = answer;
          answer = answer.substring(0,t.length()-1);
        } is0 {
          answer += "0";
        } answer += "0" answer "0" if(is1){
          answer += "1";
        }else if(isB && !isAns0){
          String t = answer;
          answer = answer.substring(0,t.length()-1);
        } is1 {
          answer += "1";
        } answer += "1" answer "1" if(isB && !isAns0){
          String t = answer;
          answer = answer.substring(0,t.length()-1);
        } isB && !isAns0 isB !isAns0 isAns0 {
          String t = answer;
          answer = answer.substring(0,t.length()-1);
        } String t = answer; t answer answer = answer.substring(0,t.length()-1) answer answer.substring(0,t.length()-1) answer.substring answer 0 t.length()-1 t.length() t.length t 1 System.out.println(answer) System.out.println System.out System System.out answer String[] args args
import java.util.*;
 
class Main{
	public static void main(String[] args){
      String answer = "";
		Scanner scan = new Scanner(System.in);
      	String s = scan.next();
      	 int l = s.length();
     	 String[] moji = new String[l];
      for(int i = 0;i < l;i++){
        moji[i]=String.valueOf(s.charAt(i));
	}
      for(String moj : moji){
        boolean is0 = moj.equals("0");
        boolean is1 = moj.equals("1");
        boolean isB = moj.equals("B");
        boolean isAns0 = answer.length()==0;
        
        if(is0){
          answer += "0";
        }else if(is1){
          answer += "1";
        }else if(isB && !isAns0){
          String t = answer;
          answer = answer.substring(0,t.length()-1);
        }
      }
        System.out.println(answer);
}
}