import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String s = sc.next();
      StringBuilder sb = new StringBuilder();
      for(int i = 0;i < s.length();i++){
      	String x = s.substring(i,i+1);
        if(x.equals("0")) sb.append("0");
        if(x.equals("1")) sb.append("1");
        if(x.equals("B") && sb.length() != 0) sb.delete(sb.length()-1,sb.length());
      }
      System.out.println(sb.toString());
    }
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String s = sc.next();
      StringBuilder sb = new StringBuilder();
      for(int i = 0;i < s.length();i++){
      	String x = s.substring(i,i+1);
        if(x.equals("0")) sb.append("0");
        if(x.equals("1")) sb.append("1");
        if(x.equals("B") && sb.length() != 0) sb.delete(sb.length()-1,sb.length());
      }
      System.out.println(sb.toString());
    }
} Main public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String s = sc.next();
      StringBuilder sb = new StringBuilder();
      for(int i = 0;i < s.length();i++){
      	String x = s.substring(i,i+1);
        if(x.equals("0")) sb.append("0");
        if(x.equals("1")) sb.append("1");
        if(x.equals("B") && sb.length() != 0) sb.delete(sb.length()-1,sb.length());
      }
      System.out.println(sb.toString());
    } main {
    	Scanner sc = new Scanner(System.in);
      String s = sc.next();
      StringBuilder sb = new StringBuilder();
      for(int i = 0;i < s.length();i++){
      	String x = s.substring(i,i+1);
        if(x.equals("0")) sb.append("0");
        if(x.equals("1")) sb.append("1");
        if(x.equals("B") && sb.length() != 0) sb.delete(sb.length()-1,sb.length());
      }
      System.out.println(sb.toString());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0;i < s.length();i++){
      	String x = s.substring(i,i+1);
        if(x.equals("0")) sb.append("0");
        if(x.equals("1")) sb.append("1");
        if(x.equals("B") && sb.length() != 0) sb.delete(sb.length()-1,sb.length());
      } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
      	String x = s.substring(i,i+1);
        if(x.equals("0")) sb.append("0");
        if(x.equals("1")) sb.append("1");
        if(x.equals("B") && sb.length() != 0) sb.delete(sb.length()-1,sb.length());
      } {
      	String x = s.substring(i,i+1);
        if(x.equals("0")) sb.append("0");
        if(x.equals("1")) sb.append("1");
        if(x.equals("B") && sb.length() != 0) sb.delete(sb.length()-1,sb.length());
      } String x = s.substring(i,i+1); x s.substring(i,i+1) s.substring s i i+1 i 1 if(x.equals("0")) sb.append("0"); x.equals("0") x.equals x "0" sb.append("0") sb.append sb "0" if(x.equals("1")) sb.append("1"); x.equals("1") x.equals x "1" sb.append("1") sb.append sb "1" if(x.equals("B") && sb.length() != 0) sb.delete(sb.length()-1,sb.length()); x.equals("B") && sb.length() != 0 x.equals("B") x.equals x "B" sb.length() != 0 sb.length() sb.length sb 0 sb.delete(sb.length()-1,sb.length()) sb.delete sb sb.length()-1 sb.length() sb.length sb 1 sb.length() sb.length sb System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String s = sc.next();
      StringBuilder sb = new StringBuilder();
      for(int i = 0;i < s.length();i++){
      	String x = s.substring(i,i+1);
        if(x.equals("0")) sb.append("0");
        if(x.equals("1")) sb.append("1");
        if(x.equals("B") && sb.length() != 0) sb.delete(sb.length()-1,sb.length());
      }
      System.out.println(sb.toString());
    }
} public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String s = sc.next();
      StringBuilder sb = new StringBuilder();
      for(int i = 0;i < s.length();i++){
      	String x = s.substring(i,i+1);
        if(x.equals("0")) sb.append("0");
        if(x.equals("1")) sb.append("1");
        if(x.equals("B") && sb.length() != 0) sb.delete(sb.length()-1,sb.length());
      }
      System.out.println(sb.toString());
    }
} Main
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String s = sc.next();
      StringBuilder sb = new StringBuilder();
      for(int i = 0;i < s.length();i++){
      	String x = s.substring(i,i+1);
        if(x.equals("0")) sb.append("0");
        if(x.equals("1")) sb.append("1");
        if(x.equals("B") && sb.length() != 0) sb.delete(sb.length()-1,sb.length());
      }
      System.out.println(sb.toString());
    }
}