import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S= sc.next();

    String result = "";
    for(int i = 0 ; i <  S.length();  i ++){
      switch( S.charAt(i)  ){
        case '0':
          result = result + "0";
        break;
        case '1':
          result = result + "1";
        break;
        case 'B':
          if(!result.isEmpty()){
            result = result.substring(0,result.length() - 1);
          }
        break;
      }
    }
    System.out.println(result);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S= sc.next();

    String result = "";
    for(int i = 0 ; i <  S.length();  i ++){
      switch( S.charAt(i)  ){
        case '0':
          result = result + "0";
        break;
        case '1':
          result = result + "1";
        break;
        case 'B':
          if(!result.isEmpty()){
            result = result.substring(0,result.length() - 1);
          }
        break;
      }
    }
    System.out.println(result);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S= sc.next();

    String result = "";
    for(int i = 0 ; i <  S.length();  i ++){
      switch( S.charAt(i)  ){
        case '0':
          result = result + "0";
        break;
        case '1':
          result = result + "1";
        break;
        case 'B':
          if(!result.isEmpty()){
            result = result.substring(0,result.length() - 1);
          }
        break;
      }
    }
    System.out.println(result);
  } main {
    Scanner sc = new Scanner(System.in);
    String S= sc.next();

    String result = "";
    for(int i = 0 ; i <  S.length();  i ++){
      switch( S.charAt(i)  ){
        case '0':
          result = result + "0";
        break;
        case '1':
          result = result + "1";
        break;
        case 'B':
          if(!result.isEmpty()){
            result = result.substring(0,result.length() - 1);
          }
        break;
      }
    }
    System.out.println(result);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S= sc.next(); S sc.next() sc.next sc String result = ""; result "" for(int i = 0 ; i <  S.length();  i ++){
      switch( S.charAt(i)  ){
        case '0':
          result = result + "0";
        break;
        case '1':
          result = result + "1";
        break;
        case 'B':
          if(!result.isEmpty()){
            result = result.substring(0,result.length() - 1);
          }
        break;
      }
    } int i = 0 ; int i = 0 ; i 0 i <  S.length() i S.length() S.length S i ++ i ++ i {
      switch( S.charAt(i)  ){
        case '0':
          result = result + "0";
        break;
        case '1':
          result = result + "1";
        break;
        case 'B':
          if(!result.isEmpty()){
            result = result.substring(0,result.length() - 1);
          }
        break;
      }
    } {
      switch( S.charAt(i)  ){
        case '0':
          result = result + "0";
        break;
        case '1':
          result = result + "1";
        break;
        case 'B':
          if(!result.isEmpty()){
            result = result.substring(0,result.length() - 1);
          }
        break;
      }
    } switch( S.charAt(i)  ){
        case '0':
          result = result + "0";
        break;
        case '1':
          result = result + "1";
        break;
        case 'B':
          if(!result.isEmpty()){
            result = result.substring(0,result.length() - 1);
          }
        break;
      } S.charAt(i) S.charAt S i case '0': '0' case '0': result = result + "0" result result + "0" result "0" break; case '1': '1' case '1': result = result + "1" result result + "1" result "1" break; case 'B': 'B' case 'B': if(!result.isEmpty()){
            result = result.substring(0,result.length() - 1);
          } !result.isEmpty() result.isEmpty() result.isEmpty result {
            result = result.substring(0,result.length() - 1);
          } result = result.substring(0,result.length() - 1) result result.substring(0,result.length() - 1) result.substring result 0 result.length() - 1 result.length() result.length result 1 break; System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S= sc.next();

    String result = "";
    for(int i = 0 ; i <  S.length();  i ++){
      switch( S.charAt(i)  ){
        case '0':
          result = result + "0";
        break;
        case '1':
          result = result + "1";
        break;
        case 'B':
          if(!result.isEmpty()){
            result = result.substring(0,result.length() - 1);
          }
        break;
      }
    }
    System.out.println(result);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S= sc.next();

    String result = "";
    for(int i = 0 ; i <  S.length();  i ++){
      switch( S.charAt(i)  ){
        case '0':
          result = result + "0";
        break;
        case '1':
          result = result + "1";
        break;
        case 'B':
          if(!result.isEmpty()){
            result = result.substring(0,result.length() - 1);
          }
        break;
      }
    }
    System.out.println(result);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S= sc.next();

    String result = "";
    for(int i = 0 ; i <  S.length();  i ++){
      switch( S.charAt(i)  ){
        case '0':
          result = result + "0";
        break;
        case '1':
          result = result + "1";
        break;
        case 'B':
          if(!result.isEmpty()){
            result = result.substring(0,result.length() - 1);
          }
        break;
      }
    }
    System.out.println(result);
  }
}
