import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String input = sc.next();
    String ans = "";
    for(int i=0; i<input.length(); i++){
      ans = pressKey(input.charAt(i), ans);
    }
    System.out.println(ans);
  }
  
  private static String pressKey(char c, String str){
    if(c == '0'){
      return str+"0";
    }
    if(c == '1'){
      return str+"1";
    }
    if(str.equals("")){
      return str;
    }
    if(c == 'B'){
      StringBuilder builder = new StringBuilder(str);
      builder.deleteCharAt(builder.length()-1);
      return builder.toString();
    }
    return null;
  }
} import java.util.Scanner; Scanner java.util class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String input = sc.next();
    String ans = "";
    for(int i=0; i<input.length(); i++){
      ans = pressKey(input.charAt(i), ans);
    }
    System.out.println(ans);
  }
  
  private static String pressKey(char c, String str){
    if(c == '0'){
      return str+"0";
    }
    if(c == '1'){
      return str+"1";
    }
    if(str.equals("")){
      return str;
    }
    if(c == 'B'){
      StringBuilder builder = new StringBuilder(str);
      builder.deleteCharAt(builder.length()-1);
      return builder.toString();
    }
    return null;
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String input = sc.next();
    String ans = "";
    for(int i=0; i<input.length(); i++){
      ans = pressKey(input.charAt(i), ans);
    }
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    String input = sc.next();
    String ans = "";
    for(int i=0; i<input.length(); i++){
      ans = pressKey(input.charAt(i), ans);
    }
    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String input = sc.next(); input sc.next() sc.next sc String ans = ""; ans "" for(int i=0; i<input.length(); i++){
      ans = pressKey(input.charAt(i), ans);
    } int i=0; int i=0; i 0 i<input.length() i input.length() input.length input i++ i++ i {
      ans = pressKey(input.charAt(i), ans);
    } {
      ans = pressKey(input.charAt(i), ans);
    } ans = pressKey(input.charAt(i), ans) ans pressKey(input.charAt(i), ans) pressKey input.charAt(i) input.charAt input i ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args private static String pressKey(char c, String str){
    if(c == '0'){
      return str+"0";
    }
    if(c == '1'){
      return str+"1";
    }
    if(str.equals("")){
      return str;
    }
    if(c == 'B'){
      StringBuilder builder = new StringBuilder(str);
      builder.deleteCharAt(builder.length()-1);
      return builder.toString();
    }
    return null;
  } pressKey {
    if(c == '0'){
      return str+"0";
    }
    if(c == '1'){
      return str+"1";
    }
    if(str.equals("")){
      return str;
    }
    if(c == 'B'){
      StringBuilder builder = new StringBuilder(str);
      builder.deleteCharAt(builder.length()-1);
      return builder.toString();
    }
    return null;
  } if(c == '0'){
      return str+"0";
    } c == '0' c '0' {
      return str+"0";
    } return str+"0"; str+"0" str "0" if(c == '1'){
      return str+"1";
    } c == '1' c '1' {
      return str+"1";
    } return str+"1"; str+"1" str "1" if(str.equals("")){
      return str;
    } str.equals("") str.equals str "" {
      return str;
    } return str; str if(c == 'B'){
      StringBuilder builder = new StringBuilder(str);
      builder.deleteCharAt(builder.length()-1);
      return builder.toString();
    } c == 'B' c 'B' {
      StringBuilder builder = new StringBuilder(str);
      builder.deleteCharAt(builder.length()-1);
      return builder.toString();
    } StringBuilder builder = new StringBuilder(str); builder new StringBuilder(str) builder.deleteCharAt(builder.length()-1) builder.deleteCharAt builder builder.length()-1 builder.length() builder.length builder 1 return builder.toString(); builder.toString() builder.toString builder return null; null char c c String str str
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String input = sc.next();
    String ans = "";
    for(int i=0; i<input.length(); i++){
      ans = pressKey(input.charAt(i), ans);
    }
    System.out.println(ans);
  }
  
  private static String pressKey(char c, String str){
    if(c == '0'){
      return str+"0";
    }
    if(c == '1'){
      return str+"1";
    }
    if(str.equals("")){
      return str;
    }
    if(c == 'B'){
      StringBuilder builder = new StringBuilder(str);
      builder.deleteCharAt(builder.length()-1);
      return builder.toString();
    }
    return null;
  }
}
