

import java.math.BigDecimal;
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        ArrayDeque<String> stack = new ArrayDeque<>();
        for (int i=0; i<s.length(); i++){
            if (s.charAt(i) == '0'){
                stack.offerLast("0");
            }else if (s.charAt(i) == '1'){
                stack.offerLast("1");
            }else if (s.charAt(i) == 'B'){
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            }
        }
        for (String b : stack){
            System.out.print(b);
        }
        System.out.println();
    }
} import java.math.BigDecimal; BigDecimal java.math import java.util.*; util.* java public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        ArrayDeque<String> stack = new ArrayDeque<>();
        for (int i=0; i<s.length(); i++){
            if (s.charAt(i) == '0'){
                stack.offerLast("0");
            }else if (s.charAt(i) == '1'){
                stack.offerLast("1");
            }else if (s.charAt(i) == 'B'){
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            }
        }
        for (String b : stack){
            System.out.print(b);
        }
        System.out.println();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        ArrayDeque<String> stack = new ArrayDeque<>();
        for (int i=0; i<s.length(); i++){
            if (s.charAt(i) == '0'){
                stack.offerLast("0");
            }else if (s.charAt(i) == '1'){
                stack.offerLast("1");
            }else if (s.charAt(i) == 'B'){
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            }
        }
        for (String b : stack){
            System.out.print(b);
        }
        System.out.println();
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        ArrayDeque<String> stack = new ArrayDeque<>();
        for (int i=0; i<s.length(); i++){
            if (s.charAt(i) == '0'){
                stack.offerLast("0");
            }else if (s.charAt(i) == '1'){
                stack.offerLast("1");
            }else if (s.charAt(i) == 'B'){
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            }
        }
        for (String b : stack){
            System.out.print(b);
        }
        System.out.println();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc ArrayDeque<String> stack = new ArrayDeque<>(); stack new ArrayDeque<>() for (int i=0; i<s.length(); i++){
            if (s.charAt(i) == '0'){
                stack.offerLast("0");
            }else if (s.charAt(i) == '1'){
                stack.offerLast("1");
            }else if (s.charAt(i) == 'B'){
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            }
        } int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
            if (s.charAt(i) == '0'){
                stack.offerLast("0");
            }else if (s.charAt(i) == '1'){
                stack.offerLast("1");
            }else if (s.charAt(i) == 'B'){
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            }
        } {
            if (s.charAt(i) == '0'){
                stack.offerLast("0");
            }else if (s.charAt(i) == '1'){
                stack.offerLast("1");
            }else if (s.charAt(i) == 'B'){
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            }
        } if (s.charAt(i) == '0'){
                stack.offerLast("0");
            }else if (s.charAt(i) == '1'){
                stack.offerLast("1");
            }else if (s.charAt(i) == 'B'){
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            } s.charAt(i) == '0' s.charAt(i) s.charAt s i '0' {
                stack.offerLast("0");
            } stack.offerLast("0") stack.offerLast stack "0" if (s.charAt(i) == '1'){
                stack.offerLast("1");
            }else if (s.charAt(i) == 'B'){
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            } s.charAt(i) == '1' s.charAt(i) s.charAt s i '1' {
                stack.offerLast("1");
            } stack.offerLast("1") stack.offerLast stack "1" if (s.charAt(i) == 'B'){
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            } s.charAt(i) == 'B' s.charAt(i) s.charAt s i 'B' {
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            } if (!(stack.isEmpty())){
                    stack.pollLast();
                } !(stack.isEmpty()) (stack.isEmpty()) stack.isEmpty stack {
                    stack.pollLast();
                } stack.pollLast() stack.pollLast stack for (String b : stack){
            System.out.print(b);
        } String b stack {
            System.out.print(b);
        } {
            System.out.print(b);
        } System.out.print(b) System.out.print System.out System System.out b System.out.println() System.out.println System.out System System.out String[] args args public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        ArrayDeque<String> stack = new ArrayDeque<>();
        for (int i=0; i<s.length(); i++){
            if (s.charAt(i) == '0'){
                stack.offerLast("0");
            }else if (s.charAt(i) == '1'){
                stack.offerLast("1");
            }else if (s.charAt(i) == 'B'){
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            }
        }
        for (String b : stack){
            System.out.print(b);
        }
        System.out.println();
    }
} public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        ArrayDeque<String> stack = new ArrayDeque<>();
        for (int i=0; i<s.length(); i++){
            if (s.charAt(i) == '0'){
                stack.offerLast("0");
            }else if (s.charAt(i) == '1'){
                stack.offerLast("1");
            }else if (s.charAt(i) == 'B'){
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            }
        }
        for (String b : stack){
            System.out.print(b);
        }
        System.out.println();
    }
} Main


import java.math.BigDecimal;
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        ArrayDeque<String> stack = new ArrayDeque<>();
        for (int i=0; i<s.length(); i++){
            if (s.charAt(i) == '0'){
                stack.offerLast("0");
            }else if (s.charAt(i) == '1'){
                stack.offerLast("1");
            }else if (s.charAt(i) == 'B'){
                if (!(stack.isEmpty())){
                    stack.pollLast();
                }
            }
        }
        for (String b : stack){
            System.out.print(b);
        }
        System.out.println();
    }
}