import java.util.ArrayList;
import java.util.Scanner;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        String inputs[] = new String[input.length()];

        ArrayList<Character> kotae = new ArrayList<Character>();

        for(int i = 0; i < input.length(); i++){
            inputs[i] = String.valueOf(input.charAt(i));
        }

        for (int i = 0; i < input.length() ; i++){

            if(inputs[i].equals("0")){
                kotae.add('0');
            }

            if(inputs[i].equals("1")){
                kotae.add(('1'));
            }

            if(inputs[i].equals("B") && kotae.size() > 0){
                kotae.remove(kotae.size() -1);
            }

        }

        for(Character an : kotae){
            System.out.print(an);
        }

    }
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        String inputs[] = new String[input.length()];

        ArrayList<Character> kotae = new ArrayList<Character>();

        for(int i = 0; i < input.length(); i++){
            inputs[i] = String.valueOf(input.charAt(i));
        }

        for (int i = 0; i < input.length() ; i++){

            if(inputs[i].equals("0")){
                kotae.add('0');
            }

            if(inputs[i].equals("1")){
                kotae.add(('1'));
            }

            if(inputs[i].equals("B") && kotae.size() > 0){
                kotae.remove(kotae.size() -1);
            }

        }

        for(Character an : kotae){
            System.out.print(an);
        }

    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        String inputs[] = new String[input.length()];

        ArrayList<Character> kotae = new ArrayList<Character>();

        for(int i = 0; i < input.length(); i++){
            inputs[i] = String.valueOf(input.charAt(i));
        }

        for (int i = 0; i < input.length() ; i++){

            if(inputs[i].equals("0")){
                kotae.add('0');
            }

            if(inputs[i].equals("1")){
                kotae.add(('1'));
            }

            if(inputs[i].equals("B") && kotae.size() > 0){
                kotae.remove(kotae.size() -1);
            }

        }

        for(Character an : kotae){
            System.out.print(an);
        }

    } main {
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        String inputs[] = new String[input.length()];

        ArrayList<Character> kotae = new ArrayList<Character>();

        for(int i = 0; i < input.length(); i++){
            inputs[i] = String.valueOf(input.charAt(i));
        }

        for (int i = 0; i < input.length() ; i++){

            if(inputs[i].equals("0")){
                kotae.add('0');
            }

            if(inputs[i].equals("1")){
                kotae.add(('1'));
            }

            if(inputs[i].equals("B") && kotae.size() > 0){
                kotae.remove(kotae.size() -1);
            }

        }

        for(Character an : kotae){
            System.out.print(an);
        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String input = sc.nextLine(); input sc.nextLine() sc.nextLine sc String inputs[] = new String[input.length()]; inputs new String[input.length()] input.length() input.length input ArrayList<Character> kotae = new ArrayList<Character>(); kotae new ArrayList<Character>() for(int i = 0; i < input.length(); i++){
            inputs[i] = String.valueOf(input.charAt(i));
        } int i = 0; int i = 0; i 0 i < input.length() i input.length() input.length input i++ i++ i {
            inputs[i] = String.valueOf(input.charAt(i));
        } {
            inputs[i] = String.valueOf(input.charAt(i));
        } inputs[i] = String.valueOf(input.charAt(i)) inputs[i] inputs i String.valueOf(input.charAt(i)) String.valueOf String input.charAt(i) input.charAt input i for (int i = 0; i < input.length() ; i++){

            if(inputs[i].equals("0")){
                kotae.add('0');
            }

            if(inputs[i].equals("1")){
                kotae.add(('1'));
            }

            if(inputs[i].equals("B") && kotae.size() > 0){
                kotae.remove(kotae.size() -1);
            }

        } int i = 0; int i = 0; i 0 i < input.length() i input.length() input.length input i++ i++ i {

            if(inputs[i].equals("0")){
                kotae.add('0');
            }

            if(inputs[i].equals("1")){
                kotae.add(('1'));
            }

            if(inputs[i].equals("B") && kotae.size() > 0){
                kotae.remove(kotae.size() -1);
            }

        } {

            if(inputs[i].equals("0")){
                kotae.add('0');
            }

            if(inputs[i].equals("1")){
                kotae.add(('1'));
            }

            if(inputs[i].equals("B") && kotae.size() > 0){
                kotae.remove(kotae.size() -1);
            }

        } if(inputs[i].equals("0")){
                kotae.add('0');
            } inputs[i].equals("0") inputs[i].equals inputs[i] inputs i "0" {
                kotae.add('0');
            } kotae.add('0') kotae.add kotae '0' if(inputs[i].equals("1")){
                kotae.add(('1'));
            } inputs[i].equals("1") inputs[i].equals inputs[i] inputs i "1" {
                kotae.add(('1'));
            } kotae.add(('1')) kotae.add kotae ('1') if(inputs[i].equals("B") && kotae.size() > 0){
                kotae.remove(kotae.size() -1);
            } inputs[i].equals("B") && kotae.size() > 0 inputs[i].equals("B") inputs[i].equals inputs[i] inputs i "B" kotae.size() > 0 kotae.size() kotae.size kotae 0 {
                kotae.remove(kotae.size() -1);
            } kotae.remove(kotae.size() -1) kotae.remove kotae kotae.size() -1 kotae.size() kotae.size kotae 1 for(Character an : kotae){
            System.out.print(an);
        } Character an kotae {
            System.out.print(an);
        } {
            System.out.print(an);
        } System.out.print(an) System.out.print System.out System System.out an String[] args args
import java.util.ArrayList;
import java.util.Scanner;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        String inputs[] = new String[input.length()];

        ArrayList<Character> kotae = new ArrayList<Character>();

        for(int i = 0; i < input.length(); i++){
            inputs[i] = String.valueOf(input.charAt(i));
        }

        for (int i = 0; i < input.length() ; i++){

            if(inputs[i].equals("0")){
                kotae.add('0');
            }

            if(inputs[i].equals("1")){
                kotae.add(('1'));
            }

            if(inputs[i].equals("B") && kotae.size() > 0){
                kotae.remove(kotae.size() -1);
            }

        }

        for(Character an : kotae){
            System.out.print(an);
        }

    }
}
