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