import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String [] a = sc.nextLine().split("");
        int b = a.length;
        String answer = "";
        for(int i = 0;i<b;i++){
            if(a[i].equals("0")){
                answer += "0";
            }
            if(a[i].equals("1")){
                answer += "1";
            }
            if(a[i].equals("B")){
                if(answer != null && answer.length() > 0){
                    answer = answer.substring(0,answer.length()-1);
                }
            }
        }
        System.out.println(answer);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String [] a = sc.nextLine().split("");
        int b = a.length;
        String answer = "";
        for(int i = 0;i<b;i++){
            if(a[i].equals("0")){
                answer += "0";
            }
            if(a[i].equals("1")){
                answer += "1";
            }
            if(a[i].equals("B")){
                if(answer != null && answer.length() > 0){
                    answer = answer.substring(0,answer.length()-1);
                }
            }
        }
        System.out.println(answer);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String [] a = sc.nextLine().split("");
        int b = a.length;
        String answer = "";
        for(int i = 0;i<b;i++){
            if(a[i].equals("0")){
                answer += "0";
            }
            if(a[i].equals("1")){
                answer += "1";
            }
            if(a[i].equals("B")){
                if(answer != null && answer.length() > 0){
                    answer = answer.substring(0,answer.length()-1);
                }
            }
        }
        System.out.println(answer);
    } main {
        Scanner sc = new Scanner(System.in);
        String [] a = sc.nextLine().split("");
        int b = a.length;
        String answer = "";
        for(int i = 0;i<b;i++){
            if(a[i].equals("0")){
                answer += "0";
            }
            if(a[i].equals("1")){
                answer += "1";
            }
            if(a[i].equals("B")){
                if(answer != null && answer.length() > 0){
                    answer = answer.substring(0,answer.length()-1);
                }
            }
        }
        System.out.println(answer);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String [] a = sc.nextLine().split(""); a sc.nextLine().split("") sc.nextLine().split sc.nextLine() sc.nextLine sc "" int b = a.length; b a.length a a.length String answer = ""; answer "" for(int i = 0;i<b;i++){
            if(a[i].equals("0")){
                answer += "0";
            }
            if(a[i].equals("1")){
                answer += "1";
            }
            if(a[i].equals("B")){
                if(answer != null && answer.length() > 0){
                    answer = answer.substring(0,answer.length()-1);
                }
            }
        } int i = 0; int i = 0; i 0 i<b i b i++ i++ i {
            if(a[i].equals("0")){
                answer += "0";
            }
            if(a[i].equals("1")){
                answer += "1";
            }
            if(a[i].equals("B")){
                if(answer != null && answer.length() > 0){
                    answer = answer.substring(0,answer.length()-1);
                }
            }
        } {
            if(a[i].equals("0")){
                answer += "0";
            }
            if(a[i].equals("1")){
                answer += "1";
            }
            if(a[i].equals("B")){
                if(answer != null && answer.length() > 0){
                    answer = answer.substring(0,answer.length()-1);
                }
            }
        } if(a[i].equals("0")){
                answer += "0";
            } a[i].equals("0") a[i].equals a[i] a i "0" {
                answer += "0";
            } answer += "0" answer "0" if(a[i].equals("1")){
                answer += "1";
            } a[i].equals("1") a[i].equals a[i] a i "1" {
                answer += "1";
            } answer += "1" answer "1" if(a[i].equals("B")){
                if(answer != null && answer.length() > 0){
                    answer = answer.substring(0,answer.length()-1);
                }
            } a[i].equals("B") a[i].equals a[i] a i "B" {
                if(answer != null && answer.length() > 0){
                    answer = answer.substring(0,answer.length()-1);
                }
            } if(answer != null && answer.length() > 0){
                    answer = answer.substring(0,answer.length()-1);
                } answer != null && answer.length() > 0 answer != null answer null answer.length() > 0 answer.length() answer.length answer 0 {
                    answer = answer.substring(0,answer.length()-1);
                } answer = answer.substring(0,answer.length()-1) answer answer.substring(0,answer.length()-1) answer.substring answer 0 answer.length()-1 answer.length() answer.length answer 1 System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String [] a = sc.nextLine().split("");
        int b = a.length;
        String answer = "";
        for(int i = 0;i<b;i++){
            if(a[i].equals("0")){
                answer += "0";
            }
            if(a[i].equals("1")){
                answer += "1";
            }
            if(a[i].equals("B")){
                if(answer != null && answer.length() > 0){
                    answer = answer.substring(0,answer.length()-1);
                }
            }
        }
        System.out.println(answer);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String [] a = sc.nextLine().split("");
        int b = a.length;
        String answer = "";
        for(int i = 0;i<b;i++){
            if(a[i].equals("0")){
                answer += "0";
            }
            if(a[i].equals("1")){
                answer += "1";
            }
            if(a[i].equals("B")){
                if(answer != null && answer.length() > 0){
                    answer = answer.substring(0,answer.length()-1);
                }
            }
        }
        System.out.println(answer);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String [] a = sc.nextLine().split("");
        int b = a.length;
        String answer = "";
        for(int i = 0;i<b;i++){
            if(a[i].equals("0")){
                answer += "0";
            }
            if(a[i].equals("1")){
                answer += "1";
            }
            if(a[i].equals("B")){
                if(answer != null && answer.length() > 0){
                    answer = answer.substring(0,answer.length()-1);
                }
            }
        }
        System.out.println(answer);
    }
}