import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] in = sc.next().toCharArray();
        List<String> out = new ArrayList<>();
        String kotae = "";
        for(int i = 0; i < in.length; i++){
            char b01 = in[i];
            if(b01 == '0'){
                out.add(out.size(),"0");
            }
            else if(b01 == '1'){
                out.add(out.size(),"1");
            }
            else if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            }
        }

        for(int i = 0; i < out.size(); i++){
            String s = out.get(i);
            kotae = kotae + s;
        }
        System.out.println(kotae);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] in = sc.next().toCharArray();
        List<String> out = new ArrayList<>();
        String kotae = "";
        for(int i = 0; i < in.length; i++){
            char b01 = in[i];
            if(b01 == '0'){
                out.add(out.size(),"0");
            }
            else if(b01 == '1'){
                out.add(out.size(),"1");
            }
            else if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            }
        }

        for(int i = 0; i < out.size(); i++){
            String s = out.get(i);
            kotae = kotae + s;
        }
        System.out.println(kotae);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] in = sc.next().toCharArray();
        List<String> out = new ArrayList<>();
        String kotae = "";
        for(int i = 0; i < in.length; i++){
            char b01 = in[i];
            if(b01 == '0'){
                out.add(out.size(),"0");
            }
            else if(b01 == '1'){
                out.add(out.size(),"1");
            }
            else if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            }
        }

        for(int i = 0; i < out.size(); i++){
            String s = out.get(i);
            kotae = kotae + s;
        }
        System.out.println(kotae);
    } main {
        Scanner sc = new Scanner(System.in);
        char[] in = sc.next().toCharArray();
        List<String> out = new ArrayList<>();
        String kotae = "";
        for(int i = 0; i < in.length; i++){
            char b01 = in[i];
            if(b01 == '0'){
                out.add(out.size(),"0");
            }
            else if(b01 == '1'){
                out.add(out.size(),"1");
            }
            else if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            }
        }

        for(int i = 0; i < out.size(); i++){
            String s = out.get(i);
            kotae = kotae + s;
        }
        System.out.println(kotae);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] in = sc.next().toCharArray(); in sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc List<String> out = new ArrayList<>(); out new ArrayList<>() String kotae = ""; kotae "" for(int i = 0; i < in.length; i++){
            char b01 = in[i];
            if(b01 == '0'){
                out.add(out.size(),"0");
            }
            else if(b01 == '1'){
                out.add(out.size(),"1");
            }
            else if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            }
        } int i = 0; int i = 0; i 0 i < in.length i in.length in in.length i++ i++ i {
            char b01 = in[i];
            if(b01 == '0'){
                out.add(out.size(),"0");
            }
            else if(b01 == '1'){
                out.add(out.size(),"1");
            }
            else if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            }
        } {
            char b01 = in[i];
            if(b01 == '0'){
                out.add(out.size(),"0");
            }
            else if(b01 == '1'){
                out.add(out.size(),"1");
            }
            else if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            }
        } char b01 = in[i]; b01 in[i] in i if(b01 == '0'){
                out.add(out.size(),"0");
            }
            else if(b01 == '1'){
                out.add(out.size(),"1");
            }
            else if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            } b01 == '0' b01 '0' {
                out.add(out.size(),"0");
            } out.add(out.size(),"0") out.add out out.size() out.size out "0" if(b01 == '1'){
                out.add(out.size(),"1");
            }
            else if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            } b01 == '1' b01 '1' {
                out.add(out.size(),"1");
            } out.add(out.size(),"1") out.add out out.size() out.size out "1" if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            } b01 == 'B' b01 'B' {
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            } if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                } out.size() == 0 out.size() out.size out 0 {
                } {
                    out.remove(out.size() - 1);
                } out.remove(out.size() - 1) out.remove out out.size() - 1 out.size() out.size out 1 for(int i = 0; i < out.size(); i++){
            String s = out.get(i);
            kotae = kotae + s;
        } int i = 0; int i = 0; i 0 i < out.size() i out.size() out.size out i++ i++ i {
            String s = out.get(i);
            kotae = kotae + s;
        } {
            String s = out.get(i);
            kotae = kotae + s;
        } String s = out.get(i); s out.get(i) out.get out i kotae = kotae + s kotae kotae + s kotae s System.out.println(kotae) System.out.println System.out System System.out kotae String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] in = sc.next().toCharArray();
        List<String> out = new ArrayList<>();
        String kotae = "";
        for(int i = 0; i < in.length; i++){
            char b01 = in[i];
            if(b01 == '0'){
                out.add(out.size(),"0");
            }
            else if(b01 == '1'){
                out.add(out.size(),"1");
            }
            else if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            }
        }

        for(int i = 0; i < out.size(); i++){
            String s = out.get(i);
            kotae = kotae + s;
        }
        System.out.println(kotae);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] in = sc.next().toCharArray();
        List<String> out = new ArrayList<>();
        String kotae = "";
        for(int i = 0; i < in.length; i++){
            char b01 = in[i];
            if(b01 == '0'){
                out.add(out.size(),"0");
            }
            else if(b01 == '1'){
                out.add(out.size(),"1");
            }
            else if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            }
        }

        for(int i = 0; i < out.size(); i++){
            String s = out.get(i);
            kotae = kotae + s;
        }
        System.out.println(kotae);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] in = sc.next().toCharArray();
        List<String> out = new ArrayList<>();
        String kotae = "";
        for(int i = 0; i < in.length; i++){
            char b01 = in[i];
            if(b01 == '0'){
                out.add(out.size(),"0");
            }
            else if(b01 == '1'){
                out.add(out.size(),"1");
            }
            else if(b01 == 'B'){
                if(out.size() == 0){
                }
                else {
                    out.remove(out.size() - 1);
                }
            }
        }

        for(int i = 0; i < out.size(); i++){
            String s = out.get(i);
            kotae = kotae + s;
        }
        System.out.println(kotae);
    }
}
