import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Stack;

public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String word = input.readLine();
        Stack<Character> characters = new Stack<>();

        for (int i = 0; i < word.length(); i++) {
            if (word.charAt(i) == 'B' && !characters.isEmpty()){
                characters.pop();
            }else if (word.charAt(i) == '1' || word.charAt(i) == '0'){

                characters.push(word.charAt(i));
            }
        }

        StringBuilder out = new StringBuilder();

        for (int i = 0; i < characters.size(); i++) {
            out.append(characters.get(i));
        }

        System.out.println(out);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Stack; Stack java.util public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String word = input.readLine();
        Stack<Character> characters = new Stack<>();

        for (int i = 0; i < word.length(); i++) {
            if (word.charAt(i) == 'B' && !characters.isEmpty()){
                characters.pop();
            }else if (word.charAt(i) == '1' || word.charAt(i) == '0'){

                characters.push(word.charAt(i));
            }
        }

        StringBuilder out = new StringBuilder();

        for (int i = 0; i < characters.size(); i++) {
            out.append(characters.get(i));
        }

        System.out.println(out);
    }
} Main public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String word = input.readLine();
        Stack<Character> characters = new Stack<>();

        for (int i = 0; i < word.length(); i++) {
            if (word.charAt(i) == 'B' && !characters.isEmpty()){
                characters.pop();
            }else if (word.charAt(i) == '1' || word.charAt(i) == '0'){

                characters.push(word.charAt(i));
            }
        }

        StringBuilder out = new StringBuilder();

        for (int i = 0; i < characters.size(); i++) {
            out.append(characters.get(i));
        }

        System.out.println(out);
    } main {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String word = input.readLine();
        Stack<Character> characters = new Stack<>();

        for (int i = 0; i < word.length(); i++) {
            if (word.charAt(i) == 'B' && !characters.isEmpty()){
                characters.pop();
            }else if (word.charAt(i) == '1' || word.charAt(i) == '0'){

                characters.push(word.charAt(i));
            }
        }

        StringBuilder out = new StringBuilder();

        for (int i = 0; i < characters.size(); i++) {
            out.append(characters.get(i));
        }

        System.out.println(out);
    } BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); input new BufferedReader(new InputStreamReader(System.in)) String word = input.readLine(); word input.readLine() input.readLine input Stack<Character> characters = new Stack<>(); characters new Stack<>() for (int i = 0; i < word.length(); i++) {
            if (word.charAt(i) == 'B' && !characters.isEmpty()){
                characters.pop();
            }else if (word.charAt(i) == '1' || word.charAt(i) == '0'){

                characters.push(word.charAt(i));
            }
        } int i = 0; int i = 0; i 0 i < word.length() i word.length() word.length word i++ i++ i {
            if (word.charAt(i) == 'B' && !characters.isEmpty()){
                characters.pop();
            }else if (word.charAt(i) == '1' || word.charAt(i) == '0'){

                characters.push(word.charAt(i));
            }
        } {
            if (word.charAt(i) == 'B' && !characters.isEmpty()){
                characters.pop();
            }else if (word.charAt(i) == '1' || word.charAt(i) == '0'){

                characters.push(word.charAt(i));
            }
        } if (word.charAt(i) == 'B' && !characters.isEmpty()){
                characters.pop();
            }else if (word.charAt(i) == '1' || word.charAt(i) == '0'){

                characters.push(word.charAt(i));
            } word.charAt(i) == 'B' && !characters.isEmpty() word.charAt(i) == 'B' word.charAt(i) word.charAt word i 'B' !characters.isEmpty() characters.isEmpty() characters.isEmpty characters {
                characters.pop();
            } characters.pop() characters.pop characters if (word.charAt(i) == '1' || word.charAt(i) == '0'){

                characters.push(word.charAt(i));
            } word.charAt(i) == '1' || word.charAt(i) == '0' word.charAt(i) == '1' word.charAt(i) word.charAt word i '1' word.charAt(i) == '0' word.charAt(i) word.charAt word i '0' {

                characters.push(word.charAt(i));
            } characters.push(word.charAt(i)) characters.push characters word.charAt(i) word.charAt word i StringBuilder out = new StringBuilder(); out new StringBuilder() for (int i = 0; i < characters.size(); i++) {
            out.append(characters.get(i));
        } int i = 0; int i = 0; i 0 i < characters.size() i characters.size() characters.size characters i++ i++ i {
            out.append(characters.get(i));
        } {
            out.append(characters.get(i));
        } out.append(characters.get(i)) out.append out characters.get(i) characters.get characters i System.out.println(out) System.out.println System.out System System.out out String[] args args public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String word = input.readLine();
        Stack<Character> characters = new Stack<>();

        for (int i = 0; i < word.length(); i++) {
            if (word.charAt(i) == 'B' && !characters.isEmpty()){
                characters.pop();
            }else if (word.charAt(i) == '1' || word.charAt(i) == '0'){

                characters.push(word.charAt(i));
            }
        }

        StringBuilder out = new StringBuilder();

        for (int i = 0; i < characters.size(); i++) {
            out.append(characters.get(i));
        }

        System.out.println(out);
    }
} public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String word = input.readLine();
        Stack<Character> characters = new Stack<>();

        for (int i = 0; i < word.length(); i++) {
            if (word.charAt(i) == 'B' && !characters.isEmpty()){
                characters.pop();
            }else if (word.charAt(i) == '1' || word.charAt(i) == '0'){

                characters.push(word.charAt(i));
            }
        }

        StringBuilder out = new StringBuilder();

        for (int i = 0; i < characters.size(); i++) {
            out.append(characters.get(i));
        }

        System.out.println(out);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Stack;

public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String word = input.readLine();
        Stack<Character> characters = new Stack<>();

        for (int i = 0; i < word.length(); i++) {
            if (word.charAt(i) == 'B' && !characters.isEmpty()){
                characters.pop();
            }else if (word.charAt(i) == '1' || word.charAt(i) == '0'){

                characters.push(word.charAt(i));
            }
        }

        StringBuilder out = new StringBuilder();

        for (int i = 0; i < characters.size(); i++) {
            out.append(characters.get(i));
        }

        System.out.println(out);
    }
}
