import java.util.*;
public class Main {
    
    static void solve(){
        Scanner sc = new Scanner(System.in);
        StringBuilder s = new StringBuilder();
        for (char ch : sc.next().toCharArray()) {
            int len = s.length();
            if(ch!='B') s.append(ch); 
            else if(len>0) s=new StringBuilder(s.toString().substring(0,len-1));
        }
        System.out.println(s);
        sc.close();
    }
    
    public static void main(String args[]) {
        solve();
    }

}    import java.util.*; util.* java public class Main {
    
    static void solve(){
        Scanner sc = new Scanner(System.in);
        StringBuilder s = new StringBuilder();
        for (char ch : sc.next().toCharArray()) {
            int len = s.length();
            if(ch!='B') s.append(ch); 
            else if(len>0) s=new StringBuilder(s.toString().substring(0,len-1));
        }
        System.out.println(s);
        sc.close();
    }
    
    public static void main(String args[]) {
        solve();
    }

} Main static void solve(){
        Scanner sc = new Scanner(System.in);
        StringBuilder s = new StringBuilder();
        for (char ch : sc.next().toCharArray()) {
            int len = s.length();
            if(ch!='B') s.append(ch); 
            else if(len>0) s=new StringBuilder(s.toString().substring(0,len-1));
        }
        System.out.println(s);
        sc.close();
    } solve {
        Scanner sc = new Scanner(System.in);
        StringBuilder s = new StringBuilder();
        for (char ch : sc.next().toCharArray()) {
            int len = s.length();
            if(ch!='B') s.append(ch); 
            else if(len>0) s=new StringBuilder(s.toString().substring(0,len-1));
        }
        System.out.println(s);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder s = new StringBuilder(); s new StringBuilder() for (char ch : sc.next().toCharArray()) {
            int len = s.length();
            if(ch!='B') s.append(ch); 
            else if(len>0) s=new StringBuilder(s.toString().substring(0,len-1));
        } char ch sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc {
            int len = s.length();
            if(ch!='B') s.append(ch); 
            else if(len>0) s=new StringBuilder(s.toString().substring(0,len-1));
        } {
            int len = s.length();
            if(ch!='B') s.append(ch); 
            else if(len>0) s=new StringBuilder(s.toString().substring(0,len-1));
        } int len = s.length(); len s.length() s.length s if(ch!='B') s.append(ch); 
            else if(len>0) s=new StringBuilder(s.toString().substring(0,len-1)); ch!='B' ch 'B' s.append(ch) s.append s ch if(len>0) s=new StringBuilder(s.toString().substring(0,len-1)); len>0 len 0 s=new StringBuilder(s.toString().substring(0,len-1)) s new StringBuilder(s.toString().substring(0,len-1)) System.out.println(s) System.out.println System.out System System.out s sc.close() sc.close sc public static void main(String args[]) {
        solve();
    } main {
        solve();
    } solve() solve String args[] args public class Main {
    
    static void solve(){
        Scanner sc = new Scanner(System.in);
        StringBuilder s = new StringBuilder();
        for (char ch : sc.next().toCharArray()) {
            int len = s.length();
            if(ch!='B') s.append(ch); 
            else if(len>0) s=new StringBuilder(s.toString().substring(0,len-1));
        }
        System.out.println(s);
        sc.close();
    }
    
    public static void main(String args[]) {
        solve();
    }

} public class Main {
    
    static void solve(){
        Scanner sc = new Scanner(System.in);
        StringBuilder s = new StringBuilder();
        for (char ch : sc.next().toCharArray()) {
            int len = s.length();
            if(ch!='B') s.append(ch); 
            else if(len>0) s=new StringBuilder(s.toString().substring(0,len-1));
        }
        System.out.println(s);
        sc.close();
    }
    
    public static void main(String args[]) {
        solve();
    }

} Main
import java.util.*;
public class Main {
    
    static void solve(){
        Scanner sc = new Scanner(System.in);
        StringBuilder s = new StringBuilder();
        for (char ch : sc.next().toCharArray()) {
            int len = s.length();
            if(ch!='B') s.append(ch); 
            else if(len>0) s=new StringBuilder(s.toString().substring(0,len-1));
        }
        System.out.println(s);
        sc.close();
    }
    
    public static void main(String args[]) {
        solve();
    }

}   
