import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.Stack;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            Stack<Integer> st = new Stack<Integer>();

            for (int i = 0; i < s.length(); i++) {
                char at = s.charAt(i);
                if ('B' == at) {
                    if(!st.empty()) st.pop();
                } else {
                    st.push(Character.getNumericValue(at));
                }
            }

            Object[] a = st.toArray();

            for (int i = 0; i < a.length; i++)
                System.out.print(a[i].toString());

            System.out.println();
        }
    }
} import java.io.IOException; IOException java.io 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 IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            Stack<Integer> st = new Stack<Integer>();

            for (int i = 0; i < s.length(); i++) {
                char at = s.charAt(i);
                if ('B' == at) {
                    if(!st.empty()) st.pop();
                } else {
                    st.push(Character.getNumericValue(at));
                }
            }

            Object[] a = st.toArray();

            for (int i = 0; i < a.length; i++)
                System.out.print(a[i].toString());

            System.out.println();
        }
    }
} Main public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            Stack<Integer> st = new Stack<Integer>();

            for (int i = 0; i < s.length(); i++) {
                char at = s.charAt(i);
                if ('B' == at) {
                    if(!st.empty()) st.pop();
                } else {
                    st.push(Character.getNumericValue(at));
                }
            }

            Object[] a = st.toArray();

            for (int i = 0; i < a.length; i++)
                System.out.print(a[i].toString());

            System.out.println();
        }
    } main {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            Stack<Integer> st = new Stack<Integer>();

            for (int i = 0; i < s.length(); i++) {
                char at = s.charAt(i);
                if ('B' == at) {
                    if(!st.empty()) st.pop();
                } else {
                    st.push(Character.getNumericValue(at));
                }
            }

            Object[] a = st.toArray();

            for (int i = 0; i < a.length; i++)
                System.out.print(a[i].toString());

            System.out.println();
        }
    } try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            Stack<Integer> st = new Stack<Integer>();

            for (int i = 0; i < s.length(); i++) {
                char at = s.charAt(i);
                if ('B' == at) {
                    if(!st.empty()) st.pop();
                } else {
                    st.push(Character.getNumericValue(at));
                }
            }

            Object[] a = st.toArray();

            for (int i = 0; i < a.length; i++)
                System.out.print(a[i].toString());

            System.out.println();
        } {
            final String s = reader.readLine();

            Stack<Integer> st = new Stack<Integer>();

            for (int i = 0; i < s.length(); i++) {
                char at = s.charAt(i);
                if ('B' == at) {
                    if(!st.empty()) st.pop();
                } else {
                    st.push(Character.getNumericValue(at));
                }
            }

            Object[] a = st.toArray();

            for (int i = 0; i < a.length; i++)
                System.out.print(a[i].toString());

            System.out.println();
        } BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) new BufferedReader(
                new InputStreamReader(System.in)) final String s = reader.readLine(); s reader.readLine() reader.readLine reader Stack<Integer> st = new Stack<Integer>(); st new Stack<Integer>() for (int i = 0; i < s.length(); i++) {
                char at = s.charAt(i);
                if ('B' == at) {
                    if(!st.empty()) st.pop();
                } else {
                    st.push(Character.getNumericValue(at));
                }
            } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
                char at = s.charAt(i);
                if ('B' == at) {
                    if(!st.empty()) st.pop();
                } else {
                    st.push(Character.getNumericValue(at));
                }
            } {
                char at = s.charAt(i);
                if ('B' == at) {
                    if(!st.empty()) st.pop();
                } else {
                    st.push(Character.getNumericValue(at));
                }
            } char at = s.charAt(i); at s.charAt(i) s.charAt s i if ('B' == at) {
                    if(!st.empty()) st.pop();
                } else {
                    st.push(Character.getNumericValue(at));
                } 'B' == at 'B' at {
                    if(!st.empty()) st.pop();
                } if(!st.empty()) st.pop(); !st.empty() st.empty() st.empty st st.pop() st.pop st {
                    st.push(Character.getNumericValue(at));
                } st.push(Character.getNumericValue(at)) st.push st Character.getNumericValue(at) Character.getNumericValue Character at Object[] a = st.toArray(); a st.toArray() st.toArray st for (int i = 0; i < a.length; i++)
                System.out.print(a[i].toString()); int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i System.out.print(a[i].toString()); System.out.print(a[i].toString()) System.out.print System.out System System.out a[i].toString() a[i].toString a[i] a i System.out.println() System.out.println System.out System System.out String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            Stack<Integer> st = new Stack<Integer>();

            for (int i = 0; i < s.length(); i++) {
                char at = s.charAt(i);
                if ('B' == at) {
                    if(!st.empty()) st.pop();
                } else {
                    st.push(Character.getNumericValue(at));
                }
            }

            Object[] a = st.toArray();

            for (int i = 0; i < a.length; i++)
                System.out.print(a[i].toString());

            System.out.println();
        }
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            Stack<Integer> st = new Stack<Integer>();

            for (int i = 0; i < s.length(); i++) {
                char at = s.charAt(i);
                if ('B' == at) {
                    if(!st.empty()) st.pop();
                } else {
                    st.push(Character.getNumericValue(at));
                }
            }

            Object[] a = st.toArray();

            for (int i = 0; i < a.length; i++)
                System.out.print(a[i].toString());

            System.out.println();
        }
    }
} Main
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.Stack;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            Stack<Integer> st = new Stack<Integer>();

            for (int i = 0; i < s.length(); i++) {
                char at = s.charAt(i);
                if ('B' == at) {
                    if(!st.empty()) st.pop();
                } else {
                    st.push(Character.getNumericValue(at));
                }
            }

            Object[] a = st.toArray();

            for (int i = 0; i < a.length; i++)
                System.out.print(a[i].toString());

            System.out.println();
        }
    }
}
