import java.util.*;

public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String[] s = sc.next().split("");
      StringBuilder sb = new StringBuilder();
      for(String t:s){
        if(t.equals("0")){
          sb.append("0");
        }
        if(t.equals("1")){
          sb.append("1");
        }
        if(t.equals("B")){
          if(sb.length() > 0){
            sb.deleteCharAt(sb.length()-1);
          }
        }
      }
      
      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().split("");
      StringBuilder sb = new StringBuilder();
      for(String t:s){
        if(t.equals("0")){
          sb.append("0");
        }
        if(t.equals("1")){
          sb.append("1");
        }
        if(t.equals("B")){
          if(sb.length() > 0){
            sb.deleteCharAt(sb.length()-1);
          }
        }
      }
      
      System.out.println(sb.toString());
    }
} Main public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String[] s = sc.next().split("");
      StringBuilder sb = new StringBuilder();
      for(String t:s){
        if(t.equals("0")){
          sb.append("0");
        }
        if(t.equals("1")){
          sb.append("1");
        }
        if(t.equals("B")){
          if(sb.length() > 0){
            sb.deleteCharAt(sb.length()-1);
          }
        }
      }
      
      System.out.println(sb.toString());
    } main {
      Scanner sc = new Scanner(System.in);
      String[] s = sc.next().split("");
      StringBuilder sb = new StringBuilder();
      for(String t:s){
        if(t.equals("0")){
          sb.append("0");
        }
        if(t.equals("1")){
          sb.append("1");
        }
        if(t.equals("B")){
          if(sb.length() > 0){
            sb.deleteCharAt(sb.length()-1);
          }
        }
      }
      
      System.out.println(sb.toString());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] s = sc.next().split(""); s sc.next().split("") sc.next().split sc.next() sc.next sc "" StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(String t:s){
        if(t.equals("0")){
          sb.append("0");
        }
        if(t.equals("1")){
          sb.append("1");
        }
        if(t.equals("B")){
          if(sb.length() > 0){
            sb.deleteCharAt(sb.length()-1);
          }
        }
      } String t s {
        if(t.equals("0")){
          sb.append("0");
        }
        if(t.equals("1")){
          sb.append("1");
        }
        if(t.equals("B")){
          if(sb.length() > 0){
            sb.deleteCharAt(sb.length()-1);
          }
        }
      } {
        if(t.equals("0")){
          sb.append("0");
        }
        if(t.equals("1")){
          sb.append("1");
        }
        if(t.equals("B")){
          if(sb.length() > 0){
            sb.deleteCharAt(sb.length()-1);
          }
        }
      } if(t.equals("0")){
          sb.append("0");
        } t.equals("0") t.equals t "0" {
          sb.append("0");
        } sb.append("0") sb.append sb "0" if(t.equals("1")){
          sb.append("1");
        } t.equals("1") t.equals t "1" {
          sb.append("1");
        } sb.append("1") sb.append sb "1" if(t.equals("B")){
          if(sb.length() > 0){
            sb.deleteCharAt(sb.length()-1);
          }
        } t.equals("B") t.equals t "B" {
          if(sb.length() > 0){
            sb.deleteCharAt(sb.length()-1);
          }
        } if(sb.length() > 0){
            sb.deleteCharAt(sb.length()-1);
          } sb.length() > 0 sb.length() sb.length sb 0 {
            sb.deleteCharAt(sb.length()-1);
          } sb.deleteCharAt(sb.length()-1) sb.deleteCharAt sb sb.length()-1 sb.length() sb.length sb 1 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().split("");
      StringBuilder sb = new StringBuilder();
      for(String t:s){
        if(t.equals("0")){
          sb.append("0");
        }
        if(t.equals("1")){
          sb.append("1");
        }
        if(t.equals("B")){
          if(sb.length() > 0){
            sb.deleteCharAt(sb.length()-1);
          }
        }
      }
      
      System.out.println(sb.toString());
    }
} public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String[] s = sc.next().split("");
      StringBuilder sb = new StringBuilder();
      for(String t:s){
        if(t.equals("0")){
          sb.append("0");
        }
        if(t.equals("1")){
          sb.append("1");
        }
        if(t.equals("B")){
          if(sb.length() > 0){
            sb.deleteCharAt(sb.length()-1);
          }
        }
      }
      
      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().split("");
      StringBuilder sb = new StringBuilder();
      for(String t:s){
        if(t.equals("0")){
          sb.append("0");
        }
        if(t.equals("1")){
          sb.append("1");
        }
        if(t.equals("B")){
          if(sb.length() > 0){
            sb.deleteCharAt(sb.length()-1);
          }
        }
      }
      
      System.out.println(sb.toString());
    }
}