import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String onEditor = scan.nextLine();

        StringBuilder sb = new StringBuilder();
        for(int i = 0 ;i < onEditor.length(); i++){
             char onScreen = onEditor.charAt(i);

             if(onScreen == 'B'){
                if(sb.length() > 0)
                 sb.replace(sb.length() - 1, sb.length(), "");
             }else{
                 sb.append(onScreen);
             }
        }

        System.out.println(sb.toString());
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String onEditor = scan.nextLine();

        StringBuilder sb = new StringBuilder();
        for(int i = 0 ;i < onEditor.length(); i++){
             char onScreen = onEditor.charAt(i);

             if(onScreen == 'B'){
                if(sb.length() > 0)
                 sb.replace(sb.length() - 1, sb.length(), "");
             }else{
                 sb.append(onScreen);
             }
        }

        System.out.println(sb.toString());
    }
} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String onEditor = scan.nextLine();

        StringBuilder sb = new StringBuilder();
        for(int i = 0 ;i < onEditor.length(); i++){
             char onScreen = onEditor.charAt(i);

             if(onScreen == 'B'){
                if(sb.length() > 0)
                 sb.replace(sb.length() - 1, sb.length(), "");
             }else{
                 sb.append(onScreen);
             }
        }

        System.out.println(sb.toString());
    } main {
        Scanner scan = new Scanner(System.in);
        String onEditor = scan.nextLine();

        StringBuilder sb = new StringBuilder();
        for(int i = 0 ;i < onEditor.length(); i++){
             char onScreen = onEditor.charAt(i);

             if(onScreen == 'B'){
                if(sb.length() > 0)
                 sb.replace(sb.length() - 1, sb.length(), "");
             }else{
                 sb.append(onScreen);
             }
        }

        System.out.println(sb.toString());
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String onEditor = scan.nextLine(); onEditor scan.nextLine() scan.nextLine scan StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0 ;i < onEditor.length(); i++){
             char onScreen = onEditor.charAt(i);

             if(onScreen == 'B'){
                if(sb.length() > 0)
                 sb.replace(sb.length() - 1, sb.length(), "");
             }else{
                 sb.append(onScreen);
             }
        } int i = 0 ; int i = 0 ; i 0 i < onEditor.length() i onEditor.length() onEditor.length onEditor i++ i++ i {
             char onScreen = onEditor.charAt(i);

             if(onScreen == 'B'){
                if(sb.length() > 0)
                 sb.replace(sb.length() - 1, sb.length(), "");
             }else{
                 sb.append(onScreen);
             }
        } {
             char onScreen = onEditor.charAt(i);

             if(onScreen == 'B'){
                if(sb.length() > 0)
                 sb.replace(sb.length() - 1, sb.length(), "");
             }else{
                 sb.append(onScreen);
             }
        } char onScreen = onEditor.charAt(i); onScreen onEditor.charAt(i) onEditor.charAt onEditor i if(onScreen == 'B'){
                if(sb.length() > 0)
                 sb.replace(sb.length() - 1, sb.length(), "");
             }else{
                 sb.append(onScreen);
             } onScreen == 'B' onScreen 'B' {
                if(sb.length() > 0)
                 sb.replace(sb.length() - 1, sb.length(), "");
             } if(sb.length() > 0)
                 sb.replace(sb.length() - 1, sb.length(), ""); sb.length() > 0 sb.length() sb.length sb 0 sb.replace(sb.length() - 1, sb.length(), "") sb.replace sb sb.length() - 1 sb.length() sb.length sb 1 sb.length() sb.length sb "" {
                 sb.append(onScreen);
             } sb.append(onScreen) sb.append sb onScreen System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args public class Main {

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String onEditor = scan.nextLine();

        StringBuilder sb = new StringBuilder();
        for(int i = 0 ;i < onEditor.length(); i++){
             char onScreen = onEditor.charAt(i);

             if(onScreen == 'B'){
                if(sb.length() > 0)
                 sb.replace(sb.length() - 1, sb.length(), "");
             }else{
                 sb.append(onScreen);
             }
        }

        System.out.println(sb.toString());
    }
} public class Main {

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String onEditor = scan.nextLine();

        StringBuilder sb = new StringBuilder();
        for(int i = 0 ;i < onEditor.length(); i++){
             char onScreen = onEditor.charAt(i);

             if(onScreen == 'B'){
                if(sb.length() > 0)
                 sb.replace(sb.length() - 1, sb.length(), "");
             }else{
                 sb.append(onScreen);
             }
        }

        System.out.println(sb.toString());
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String onEditor = scan.nextLine();

        StringBuilder sb = new StringBuilder();
        for(int i = 0 ;i < onEditor.length(); i++){
             char onScreen = onEditor.charAt(i);

             if(onScreen == 'B'){
                if(sb.length() > 0)
                 sb.replace(sb.length() - 1, sb.length(), "");
             }else{
                 sb.append(onScreen);
             }
        }

        System.out.println(sb.toString());
    }
}
