import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String in = sc.next();
        int n=in.length();
        char[] inArray = in.toCharArray();
        int pt=-1;
        char[] display = new char[n];

        for(int i=0;i<n;i++)display[i]='\0';

        for(int i=0;i<n;i++){
            if(inArray[i]=='B'){
                if(pt!=-1){
                    display[pt]='\0';
                    pt--;
                }
            }else{
                pt++;
                display[pt]=inArray[i];
            }
        }

        for(int i=0;i<n;i++){
            if(display[i]!='\0')System.out.print(display[i]);
        }




    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String in = sc.next();
        int n=in.length();
        char[] inArray = in.toCharArray();
        int pt=-1;
        char[] display = new char[n];

        for(int i=0;i<n;i++)display[i]='\0';

        for(int i=0;i<n;i++){
            if(inArray[i]=='B'){
                if(pt!=-1){
                    display[pt]='\0';
                    pt--;
                }
            }else{
                pt++;
                display[pt]=inArray[i];
            }
        }

        for(int i=0;i<n;i++){
            if(display[i]!='\0')System.out.print(display[i]);
        }




    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String in = sc.next();
        int n=in.length();
        char[] inArray = in.toCharArray();
        int pt=-1;
        char[] display = new char[n];

        for(int i=0;i<n;i++)display[i]='\0';

        for(int i=0;i<n;i++){
            if(inArray[i]=='B'){
                if(pt!=-1){
                    display[pt]='\0';
                    pt--;
                }
            }else{
                pt++;
                display[pt]=inArray[i];
            }
        }

        for(int i=0;i<n;i++){
            if(display[i]!='\0')System.out.print(display[i]);
        }




    } main {

        Scanner sc = new Scanner(System.in);
        String in = sc.next();
        int n=in.length();
        char[] inArray = in.toCharArray();
        int pt=-1;
        char[] display = new char[n];

        for(int i=0;i<n;i++)display[i]='\0';

        for(int i=0;i<n;i++){
            if(inArray[i]=='B'){
                if(pt!=-1){
                    display[pt]='\0';
                    pt--;
                }
            }else{
                pt++;
                display[pt]=inArray[i];
            }
        }

        for(int i=0;i<n;i++){
            if(display[i]!='\0')System.out.print(display[i]);
        }




    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String in = sc.next(); in sc.next() sc.next sc int n=in.length(); n in.length() in.length in char[] inArray = in.toCharArray(); inArray in.toCharArray() in.toCharArray in int pt=-1; pt -1 1 char[] display = new char[n]; display new char[n] n for(int i=0;i<n;i++)display[i]='\0'; int i=0; int i=0; i 0 i<n i n i++ i++ i display[i]='\0'; display[i]='\0' display[i] display i '\0' for(int i=0;i<n;i++){
            if(inArray[i]=='B'){
                if(pt!=-1){
                    display[pt]='\0';
                    pt--;
                }
            }else{
                pt++;
                display[pt]=inArray[i];
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            if(inArray[i]=='B'){
                if(pt!=-1){
                    display[pt]='\0';
                    pt--;
                }
            }else{
                pt++;
                display[pt]=inArray[i];
            }
        } {
            if(inArray[i]=='B'){
                if(pt!=-1){
                    display[pt]='\0';
                    pt--;
                }
            }else{
                pt++;
                display[pt]=inArray[i];
            }
        } if(inArray[i]=='B'){
                if(pt!=-1){
                    display[pt]='\0';
                    pt--;
                }
            }else{
                pt++;
                display[pt]=inArray[i];
            } inArray[i]=='B' inArray[i] inArray i 'B' {
                if(pt!=-1){
                    display[pt]='\0';
                    pt--;
                }
            } if(pt!=-1){
                    display[pt]='\0';
                    pt--;
                } pt!=-1 pt -1 1 {
                    display[pt]='\0';
                    pt--;
                } display[pt]='\0' display[pt] display pt '\0' pt-- pt {
                pt++;
                display[pt]=inArray[i];
            } pt++ pt display[pt]=inArray[i] display[pt] display pt inArray[i] inArray i for(int i=0;i<n;i++){
            if(display[i]!='\0')System.out.print(display[i]);
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            if(display[i]!='\0')System.out.print(display[i]);
        } {
            if(display[i]!='\0')System.out.print(display[i]);
        } if(display[i]!='\0')System.out.print(display[i]); display[i]!='\0' display[i] display i '\0' System.out.print(display[i]) System.out.print System.out System System.out display[i] display i String[] args args public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String in = sc.next();
        int n=in.length();
        char[] inArray = in.toCharArray();
        int pt=-1;
        char[] display = new char[n];

        for(int i=0;i<n;i++)display[i]='\0';

        for(int i=0;i<n;i++){
            if(inArray[i]=='B'){
                if(pt!=-1){
                    display[pt]='\0';
                    pt--;
                }
            }else{
                pt++;
                display[pt]=inArray[i];
            }
        }

        for(int i=0;i<n;i++){
            if(display[i]!='\0')System.out.print(display[i]);
        }




    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String in = sc.next();
        int n=in.length();
        char[] inArray = in.toCharArray();
        int pt=-1;
        char[] display = new char[n];

        for(int i=0;i<n;i++)display[i]='\0';

        for(int i=0;i<n;i++){
            if(inArray[i]=='B'){
                if(pt!=-1){
                    display[pt]='\0';
                    pt--;
                }
            }else{
                pt++;
                display[pt]=inArray[i];
            }
        }

        for(int i=0;i<n;i++){
            if(display[i]!='\0')System.out.print(display[i]);
        }




    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String in = sc.next();
        int n=in.length();
        char[] inArray = in.toCharArray();
        int pt=-1;
        char[] display = new char[n];

        for(int i=0;i<n;i++)display[i]='\0';

        for(int i=0;i<n;i++){
            if(inArray[i]=='B'){
                if(pt!=-1){
                    display[pt]='\0';
                    pt--;
                }
            }else{
                pt++;
                display[pt]=inArray[i];
            }
        }

        for(int i=0;i<n;i++){
            if(display[i]!='\0')System.out.print(display[i]);
        }




    }
}
