import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s=sc.next();
        String output="";
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='B'){
                if(output.length()!=0){
                    output=output.substring(0,output.length()-1);
                }
            }else{
                output+=s.substring(i,i+1);
            }
        }
        System.out.println(output);
        
    }
    
 
} 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 output="";
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='B'){
                if(output.length()!=0){
                    output=output.substring(0,output.length()-1);
                }
            }else{
                output+=s.substring(i,i+1);
            }
        }
        System.out.println(output);
        
    }
    
 
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s=sc.next();
        String output="";
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='B'){
                if(output.length()!=0){
                    output=output.substring(0,output.length()-1);
                }
            }else{
                output+=s.substring(i,i+1);
            }
        }
        System.out.println(output);
        
    } main {
        Scanner sc = new Scanner(System.in);
        String s=sc.next();
        String output="";
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='B'){
                if(output.length()!=0){
                    output=output.substring(0,output.length()-1);
                }
            }else{
                output+=s.substring(i,i+1);
            }
        }
        System.out.println(output);
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s=sc.next(); s sc.next() sc.next sc String output=""; output "" for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='B'){
                if(output.length()!=0){
                    output=output.substring(0,output.length()-1);
                }
            }else{
                output+=s.substring(i,i+1);
            }
        } int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
            if(s.charAt(i)=='B'){
                if(output.length()!=0){
                    output=output.substring(0,output.length()-1);
                }
            }else{
                output+=s.substring(i,i+1);
            }
        } {
            if(s.charAt(i)=='B'){
                if(output.length()!=0){
                    output=output.substring(0,output.length()-1);
                }
            }else{
                output+=s.substring(i,i+1);
            }
        } if(s.charAt(i)=='B'){
                if(output.length()!=0){
                    output=output.substring(0,output.length()-1);
                }
            }else{
                output+=s.substring(i,i+1);
            } s.charAt(i)=='B' s.charAt(i) s.charAt s i 'B' {
                if(output.length()!=0){
                    output=output.substring(0,output.length()-1);
                }
            } if(output.length()!=0){
                    output=output.substring(0,output.length()-1);
                } output.length()!=0 output.length() output.length output 0 {
                    output=output.substring(0,output.length()-1);
                } output=output.substring(0,output.length()-1) output output.substring(0,output.length()-1) output.substring output 0 output.length()-1 output.length() output.length output 1 {
                output+=s.substring(i,i+1);
            } output+=s.substring(i,i+1) output s.substring(i,i+1) s.substring s i i+1 i 1 System.out.println(output) System.out.println System.out System System.out output String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s=sc.next();
        String output="";
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='B'){
                if(output.length()!=0){
                    output=output.substring(0,output.length()-1);
                }
            }else{
                output+=s.substring(i,i+1);
            }
        }
        System.out.println(output);
        
    }
    
 
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s=sc.next();
        String output="";
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='B'){
                if(output.length()!=0){
                    output=output.substring(0,output.length()-1);
                }
            }else{
                output+=s.substring(i,i+1);
            }
        }
        System.out.println(output);
        
    }
    
 
} Main
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s=sc.next();
        String output="";
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='B'){
                if(output.length()!=0){
                    output=output.substring(0,output.length()-1);
                }
            }else{
                output+=s.substring(i,i+1);
            }
        }
        System.out.println(output);
        
    }
    
 
}