import java.util.Scanner;

public class Main{
  public static void main(String[] args){
  	Scanner scan = new Scanner(System.in);
    
    String str = scan.next();
  
    int len = str.length();
   
    String ans[] = new String[10];
    int i;
    int j = 0;
    for(i = 0; i < len; i++){
      if(str.charAt(i) != 'B'){
      	ans[j] = String.valueOf(str.charAt(i));
        j++;
      }
      else if(str.charAt(i) == 'B'){
        if(j != 0){
          j--;
          ans[j] = "";
        }
      	
      }
    }
    
    for(String a : ans){
      if(a != null){
         System.out.print(a);     
      }
      else{
      	break;
      }
    }
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
  	Scanner scan = new Scanner(System.in);
    
    String str = scan.next();
  
    int len = str.length();
   
    String ans[] = new String[10];
    int i;
    int j = 0;
    for(i = 0; i < len; i++){
      if(str.charAt(i) != 'B'){
      	ans[j] = String.valueOf(str.charAt(i));
        j++;
      }
      else if(str.charAt(i) == 'B'){
        if(j != 0){
          j--;
          ans[j] = "";
        }
      	
      }
    }
    
    for(String a : ans){
      if(a != null){
         System.out.print(a);     
      }
      else{
      	break;
      }
    }
  }
} Main public static void main(String[] args){
  	Scanner scan = new Scanner(System.in);
    
    String str = scan.next();
  
    int len = str.length();
   
    String ans[] = new String[10];
    int i;
    int j = 0;
    for(i = 0; i < len; i++){
      if(str.charAt(i) != 'B'){
      	ans[j] = String.valueOf(str.charAt(i));
        j++;
      }
      else if(str.charAt(i) == 'B'){
        if(j != 0){
          j--;
          ans[j] = "";
        }
      	
      }
    }
    
    for(String a : ans){
      if(a != null){
         System.out.print(a);     
      }
      else{
      	break;
      }
    }
  } main {
  	Scanner scan = new Scanner(System.in);
    
    String str = scan.next();
  
    int len = str.length();
   
    String ans[] = new String[10];
    int i;
    int j = 0;
    for(i = 0; i < len; i++){
      if(str.charAt(i) != 'B'){
      	ans[j] = String.valueOf(str.charAt(i));
        j++;
      }
      else if(str.charAt(i) == 'B'){
        if(j != 0){
          j--;
          ans[j] = "";
        }
      	
      }
    }
    
    for(String a : ans){
      if(a != null){
         System.out.print(a);     
      }
      else{
      	break;
      }
    }
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String str = scan.next(); str scan.next() scan.next scan int len = str.length(); len str.length() str.length str String ans[] = new String[10]; ans new String[10] 10 int i; i int j = 0; j 0 for(i = 0; i < len; i++){
      if(str.charAt(i) != 'B'){
      	ans[j] = String.valueOf(str.charAt(i));
        j++;
      }
      else if(str.charAt(i) == 'B'){
        if(j != 0){
          j--;
          ans[j] = "";
        }
      	
      }
    } i = 0; i = 0 i 0 i < len i len i++ i++ i {
      if(str.charAt(i) != 'B'){
      	ans[j] = String.valueOf(str.charAt(i));
        j++;
      }
      else if(str.charAt(i) == 'B'){
        if(j != 0){
          j--;
          ans[j] = "";
        }
      	
      }
    } {
      if(str.charAt(i) != 'B'){
      	ans[j] = String.valueOf(str.charAt(i));
        j++;
      }
      else if(str.charAt(i) == 'B'){
        if(j != 0){
          j--;
          ans[j] = "";
        }
      	
      }
    } if(str.charAt(i) != 'B'){
      	ans[j] = String.valueOf(str.charAt(i));
        j++;
      }
      else if(str.charAt(i) == 'B'){
        if(j != 0){
          j--;
          ans[j] = "";
        }
      	
      } str.charAt(i) != 'B' str.charAt(i) str.charAt str i 'B' {
      	ans[j] = String.valueOf(str.charAt(i));
        j++;
      } ans[j] = String.valueOf(str.charAt(i)) ans[j] ans j String.valueOf(str.charAt(i)) String.valueOf String str.charAt(i) str.charAt str i j++ j if(str.charAt(i) == 'B'){
        if(j != 0){
          j--;
          ans[j] = "";
        }
      	
      } str.charAt(i) == 'B' str.charAt(i) str.charAt str i 'B' {
        if(j != 0){
          j--;
          ans[j] = "";
        }
      	
      } if(j != 0){
          j--;
          ans[j] = "";
        } j != 0 j 0 {
          j--;
          ans[j] = "";
        } j-- j ans[j] = "" ans[j] ans j "" for(String a : ans){
      if(a != null){
         System.out.print(a);     
      }
      else{
      	break;
      }
    } String a ans {
      if(a != null){
         System.out.print(a);     
      }
      else{
      	break;
      }
    } {
      if(a != null){
         System.out.print(a);     
      }
      else{
      	break;
      }
    } if(a != null){
         System.out.print(a);     
      }
      else{
      	break;
      } a != null a null {
         System.out.print(a);     
      } System.out.print(a) System.out.print System.out System System.out a {
      	break;
      } break; String[] args args public class Main{
  public static void main(String[] args){
  	Scanner scan = new Scanner(System.in);
    
    String str = scan.next();
  
    int len = str.length();
   
    String ans[] = new String[10];
    int i;
    int j = 0;
    for(i = 0; i < len; i++){
      if(str.charAt(i) != 'B'){
      	ans[j] = String.valueOf(str.charAt(i));
        j++;
      }
      else if(str.charAt(i) == 'B'){
        if(j != 0){
          j--;
          ans[j] = "";
        }
      	
      }
    }
    
    for(String a : ans){
      if(a != null){
         System.out.print(a);     
      }
      else{
      	break;
      }
    }
  }
} public class Main{
  public static void main(String[] args){
  	Scanner scan = new Scanner(System.in);
    
    String str = scan.next();
  
    int len = str.length();
   
    String ans[] = new String[10];
    int i;
    int j = 0;
    for(i = 0; i < len; i++){
      if(str.charAt(i) != 'B'){
      	ans[j] = String.valueOf(str.charAt(i));
        j++;
      }
      else if(str.charAt(i) == 'B'){
        if(j != 0){
          j--;
          ans[j] = "";
        }
      	
      }
    }
    
    for(String a : ans){
      if(a != null){
         System.out.print(a);     
      }
      else{
      	break;
      }
    }
  }
} Main
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
  	Scanner scan = new Scanner(System.in);
    
    String str = scan.next();
  
    int len = str.length();
   
    String ans[] = new String[10];
    int i;
    int j = 0;
    for(i = 0; i < len; i++){
      if(str.charAt(i) != 'B'){
      	ans[j] = String.valueOf(str.charAt(i));
        j++;
      }
      else if(str.charAt(i) == 'B'){
        if(j != 0){
          j--;
          ans[j] = "";
        }
      	
      }
    }
    
    for(String a : ans){
      if(a != null){
         System.out.print(a);     
      }
      else{
      	break;
      }
    }
  }
}
