import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int len = s.length();
    String fs;
    String ls = "";
    int lslen = 0;

    for(int i = 0;i < len;i++){
      fs = s.substring(i,(i+1));
      if(fs.equals("0") || fs.equals("1")){
        ls = ls + fs;
      }else if(fs.equals("B")){
        if(!(ls.equals(""))){
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        }
      }
    }
    System.out.println(ls);
  }
} import java.util.*; util.* java class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int len = s.length();
    String fs;
    String ls = "";
    int lslen = 0;

    for(int i = 0;i < len;i++){
      fs = s.substring(i,(i+1));
      if(fs.equals("0") || fs.equals("1")){
        ls = ls + fs;
      }else if(fs.equals("B")){
        if(!(ls.equals(""))){
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        }
      }
    }
    System.out.println(ls);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int len = s.length();
    String fs;
    String ls = "";
    int lslen = 0;

    for(int i = 0;i < len;i++){
      fs = s.substring(i,(i+1));
      if(fs.equals("0") || fs.equals("1")){
        ls = ls + fs;
      }else if(fs.equals("B")){
        if(!(ls.equals(""))){
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        }
      }
    }
    System.out.println(ls);
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int len = s.length();
    String fs;
    String ls = "";
    int lslen = 0;

    for(int i = 0;i < len;i++){
      fs = s.substring(i,(i+1));
      if(fs.equals("0") || fs.equals("1")){
        ls = ls + fs;
      }else if(fs.equals("B")){
        if(!(ls.equals(""))){
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        }
      }
    }
    System.out.println(ls);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int len = s.length(); len s.length() s.length s String fs; fs String ls = ""; ls "" int lslen = 0; lslen 0 for(int i = 0;i < len;i++){
      fs = s.substring(i,(i+1));
      if(fs.equals("0") || fs.equals("1")){
        ls = ls + fs;
      }else if(fs.equals("B")){
        if(!(ls.equals(""))){
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        }
      }
    } int i = 0; int i = 0; i 0 i < len i len i++ i++ i {
      fs = s.substring(i,(i+1));
      if(fs.equals("0") || fs.equals("1")){
        ls = ls + fs;
      }else if(fs.equals("B")){
        if(!(ls.equals(""))){
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        }
      }
    } {
      fs = s.substring(i,(i+1));
      if(fs.equals("0") || fs.equals("1")){
        ls = ls + fs;
      }else if(fs.equals("B")){
        if(!(ls.equals(""))){
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        }
      }
    } fs = s.substring(i,(i+1)) fs s.substring(i,(i+1)) s.substring s i (i+1) i 1 if(fs.equals("0") || fs.equals("1")){
        ls = ls + fs;
      }else if(fs.equals("B")){
        if(!(ls.equals(""))){
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        }
      } fs.equals("0") || fs.equals("1") fs.equals("0") fs.equals fs "0" fs.equals("1") fs.equals fs "1" {
        ls = ls + fs;
      } ls = ls + fs ls ls + fs ls fs if(fs.equals("B")){
        if(!(ls.equals(""))){
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        }
      } fs.equals("B") fs.equals fs "B" {
        if(!(ls.equals(""))){
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        }
      } if(!(ls.equals(""))){
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        } !(ls.equals("")) (ls.equals("")) ls.equals ls "" {
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        } lslen = ls.length() lslen ls.length() ls.length ls lslen -= 1 lslen 1 ls = ls.substring(0,lslen) ls ls.substring(0,lslen) ls.substring ls 0 lslen System.out.println(ls) System.out.println System.out System System.out ls String[] args args
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int len = s.length();
    String fs;
    String ls = "";
    int lslen = 0;

    for(int i = 0;i < len;i++){
      fs = s.substring(i,(i+1));
      if(fs.equals("0") || fs.equals("1")){
        ls = ls + fs;
      }else if(fs.equals("B")){
        if(!(ls.equals(""))){
          lslen = ls.length();
          lslen -= 1;
          ls = ls.substring(0,lslen);
        }
      }
    }
    System.out.println(ls);
  }
}
