import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.nextLine();
    
    StringBuilder sb = new StringBuilder();
    
    int len = str.length();
    char c ;

    for(int i=0 ; i < len ; i++){
        
        c = str.charAt(i);
        
        switch(c){
            
            case '0':
            case '1':
                sb.append(c);
                break;
                
            case 'B':
                if(sb.length() == 0){
                    break;
                }else{
                    sb.setLength(sb.length()-1);
                }
                break;
        }
    }

    System.out.println(sb);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.nextLine();
    
    StringBuilder sb = new StringBuilder();
    
    int len = str.length();
    char c ;

    for(int i=0 ; i < len ; i++){
        
        c = str.charAt(i);
        
        switch(c){
            
            case '0':
            case '1':
                sb.append(c);
                break;
                
            case 'B':
                if(sb.length() == 0){
                    break;
                }else{
                    sb.setLength(sb.length()-1);
                }
                break;
        }
    }

    System.out.println(sb);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.nextLine();
    
    StringBuilder sb = new StringBuilder();
    
    int len = str.length();
    char c ;

    for(int i=0 ; i < len ; i++){
        
        c = str.charAt(i);
        
        switch(c){
            
            case '0':
            case '1':
                sb.append(c);
                break;
                
            case 'B':
                if(sb.length() == 0){
                    break;
                }else{
                    sb.setLength(sb.length()-1);
                }
                break;
        }
    }

    System.out.println(sb);
  } main {
    Scanner sc = new Scanner(System.in);
    String str = sc.nextLine();
    
    StringBuilder sb = new StringBuilder();
    
    int len = str.length();
    char c ;

    for(int i=0 ; i < len ; i++){
        
        c = str.charAt(i);
        
        switch(c){
            
            case '0':
            case '1':
                sb.append(c);
                break;
                
            case 'B':
                if(sb.length() == 0){
                    break;
                }else{
                    sb.setLength(sb.length()-1);
                }
                break;
        }
    }

    System.out.println(sb);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc StringBuilder sb = new StringBuilder(); sb new StringBuilder() int len = str.length(); len str.length() str.length str char c ; c for(int i=0 ; i < len ; i++){
        
        c = str.charAt(i);
        
        switch(c){
            
            case '0':
            case '1':
                sb.append(c);
                break;
                
            case 'B':
                if(sb.length() == 0){
                    break;
                }else{
                    sb.setLength(sb.length()-1);
                }
                break;
        }
    } int i=0 ; int i=0 ; i 0 i < len i len i++ i++ i {
        
        c = str.charAt(i);
        
        switch(c){
            
            case '0':
            case '1':
                sb.append(c);
                break;
                
            case 'B':
                if(sb.length() == 0){
                    break;
                }else{
                    sb.setLength(sb.length()-1);
                }
                break;
        }
    } {
        
        c = str.charAt(i);
        
        switch(c){
            
            case '0':
            case '1':
                sb.append(c);
                break;
                
            case 'B':
                if(sb.length() == 0){
                    break;
                }else{
                    sb.setLength(sb.length()-1);
                }
                break;
        }
    } c = str.charAt(i) c str.charAt(i) str.charAt str i switch(c){
            
            case '0':
            case '1':
                sb.append(c);
                break;
                
            case 'B':
                if(sb.length() == 0){
                    break;
                }else{
                    sb.setLength(sb.length()-1);
                }
                break;
        } c case '0': '0' case '0': case '1': '1' case '1': sb.append(c) sb.append sb c break; case 'B': 'B' case 'B': if(sb.length() == 0){
                    break;
                }else{
                    sb.setLength(sb.length()-1);
                } sb.length() == 0 sb.length() sb.length sb 0 {
                    break;
                } break; {
                    sb.setLength(sb.length()-1);
                } sb.setLength(sb.length()-1) sb.setLength sb sb.length()-1 sb.length() sb.length sb 1 break; System.out.println(sb) System.out.println System.out System System.out sb String[] args args public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.nextLine();
    
    StringBuilder sb = new StringBuilder();
    
    int len = str.length();
    char c ;

    for(int i=0 ; i < len ; i++){
        
        c = str.charAt(i);
        
        switch(c){
            
            case '0':
            case '1':
                sb.append(c);
                break;
                
            case 'B':
                if(sb.length() == 0){
                    break;
                }else{
                    sb.setLength(sb.length()-1);
                }
                break;
        }
    }

    System.out.println(sb);
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.nextLine();
    
    StringBuilder sb = new StringBuilder();
    
    int len = str.length();
    char c ;

    for(int i=0 ; i < len ; i++){
        
        c = str.charAt(i);
        
        switch(c){
            
            case '0':
            case '1':
                sb.append(c);
                break;
                
            case 'B':
                if(sb.length() == 0){
                    break;
                }else{
                    sb.setLength(sb.length()-1);
                }
                break;
        }
    }

    System.out.println(sb);
  }
} Main
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.nextLine();
    
    StringBuilder sb = new StringBuilder();
    
    int len = str.length();
    char c ;

    for(int i=0 ; i < len ; i++){
        
        c = str.charAt(i);
        
        switch(c){
            
            case '0':
            case '1':
                sb.append(c);
                break;
                
            case 'B':
                if(sb.length() == 0){
                    break;
                }else{
                    sb.setLength(sb.length()-1);
                }
                break;
        }
    }

    System.out.println(sb);
  }
}