import java.util.Scanner;
import java.util.Stack;
public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        Stack<Integer> st = new Stack<>();
        int count = 0;
        for(int i=0; i<s.length(); i++){
            if(s.charAt(i) == '0') {
                st.push(0);
                count++;
            }
            else if(s.charAt(i) == '1') {
                st.push(1);
                count++;
            }
            else if(s.charAt(i) == 'B') {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            }
        }
        for(int i=0; i<count; i++){
            System.out.print(st.get(i));
        }
    }
} import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        Stack<Integer> st = new Stack<>();
        int count = 0;
        for(int i=0; i<s.length(); i++){
            if(s.charAt(i) == '0') {
                st.push(0);
                count++;
            }
            else if(s.charAt(i) == '1') {
                st.push(1);
                count++;
            }
            else if(s.charAt(i) == 'B') {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            }
        }
        for(int i=0; i<count; i++){
            System.out.print(st.get(i));
        }
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        Stack<Integer> st = new Stack<>();
        int count = 0;
        for(int i=0; i<s.length(); i++){
            if(s.charAt(i) == '0') {
                st.push(0);
                count++;
            }
            else if(s.charAt(i) == '1') {
                st.push(1);
                count++;
            }
            else if(s.charAt(i) == 'B') {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            }
        }
        for(int i=0; i<count; i++){
            System.out.print(st.get(i));
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        Stack<Integer> st = new Stack<>();
        int count = 0;
        for(int i=0; i<s.length(); i++){
            if(s.charAt(i) == '0') {
                st.push(0);
                count++;
            }
            else if(s.charAt(i) == '1') {
                st.push(1);
                count++;
            }
            else if(s.charAt(i) == 'B') {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            }
        }
        for(int i=0; i<count; i++){
            System.out.print(st.get(i));
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner Stack<Integer> st = new Stack<>(); st new Stack<>() int count = 0; count 0 for(int i=0; i<s.length(); i++){
            if(s.charAt(i) == '0') {
                st.push(0);
                count++;
            }
            else if(s.charAt(i) == '1') {
                st.push(1);
                count++;
            }
            else if(s.charAt(i) == 'B') {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            }
        } 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') {
                st.push(0);
                count++;
            }
            else if(s.charAt(i) == '1') {
                st.push(1);
                count++;
            }
            else if(s.charAt(i) == 'B') {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            }
        } {
            if(s.charAt(i) == '0') {
                st.push(0);
                count++;
            }
            else if(s.charAt(i) == '1') {
                st.push(1);
                count++;
            }
            else if(s.charAt(i) == 'B') {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            }
        } if(s.charAt(i) == '0') {
                st.push(0);
                count++;
            }
            else if(s.charAt(i) == '1') {
                st.push(1);
                count++;
            }
            else if(s.charAt(i) == 'B') {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            } s.charAt(i) == '0' s.charAt(i) s.charAt s i '0' {
                st.push(0);
                count++;
            } st.push(0) st.push st 0 count++ count if(s.charAt(i) == '1') {
                st.push(1);
                count++;
            }
            else if(s.charAt(i) == 'B') {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            } s.charAt(i) == '1' s.charAt(i) s.charAt s i '1' {
                st.push(1);
                count++;
            } st.push(1) st.push st 1 count++ count if(s.charAt(i) == 'B') {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            } s.charAt(i) == 'B' s.charAt(i) s.charAt s i 'B' {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            } if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                } count == 0 count 0 {
                    // do nothing
                } {
                    st.pop();
                    count--;
                } st.pop() st.pop st count-- count for(int i=0; i<count; i++){
            System.out.print(st.get(i));
        } int i=0; int i=0; i 0 i<count i count i++ i++ i {
            System.out.print(st.get(i));
        } {
            System.out.print(st.get(i));
        } System.out.print(st.get(i)) System.out.print System.out System System.out st.get(i) st.get st i String[] args args public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        Stack<Integer> st = new Stack<>();
        int count = 0;
        for(int i=0; i<s.length(); i++){
            if(s.charAt(i) == '0') {
                st.push(0);
                count++;
            }
            else if(s.charAt(i) == '1') {
                st.push(1);
                count++;
            }
            else if(s.charAt(i) == 'B') {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            }
        }
        for(int i=0; i<count; i++){
            System.out.print(st.get(i));
        }
    }
} public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        Stack<Integer> st = new Stack<>();
        int count = 0;
        for(int i=0; i<s.length(); i++){
            if(s.charAt(i) == '0') {
                st.push(0);
                count++;
            }
            else if(s.charAt(i) == '1') {
                st.push(1);
                count++;
            }
            else if(s.charAt(i) == 'B') {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            }
        }
        for(int i=0; i<count; i++){
            System.out.print(st.get(i));
        }
    }
} Main
import java.util.Scanner;
import java.util.Stack;
public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        Stack<Integer> st = new Stack<>();
        int count = 0;
        for(int i=0; i<s.length(); i++){
            if(s.charAt(i) == '0') {
                st.push(0);
                count++;
            }
            else if(s.charAt(i) == '1') {
                st.push(1);
                count++;
            }
            else if(s.charAt(i) == 'B') {
                if(count == 0){
                    // do nothing
                } else {
                    st.pop();
                    count--;
                }
            }
        }
        for(int i=0; i<count; i++){
            System.out.print(st.get(i));
        }
    }
}