import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BUnhappyHackingABCEdit solver = new BUnhappyHackingABCEdit();
        solver.solve(1, in, out);
        out.close();
    }

    static class BUnhappyHackingABCEdit {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            String s = in.string();
            StringBuilder d = new StringBuilder();
            for (char c : s.toCharArray()) {
                switch (c) {
                    case '0':
                        d.append("0");
                        break;
                    case '1':
                        d.append("1");
                        break;
                    case 'B':
                        if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        }
                        break;
                }
            }
            out.println(d);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.io.UncheckedIOException; UncheckedIOException java.io import java.util.StringTokenizer; StringTokenizer java.util import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.InputStream; InputStream java.io public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BUnhappyHackingABCEdit solver = new BUnhappyHackingABCEdit();
        solver.solve(1, in, out);
        out.close();
    }

    static class BUnhappyHackingABCEdit {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            String s = in.string();
            StringBuilder d = new StringBuilder();
            for (char c : s.toCharArray()) {
                switch (c) {
                    case '0':
                        d.append("0");
                        break;
                    case '1':
                        d.append("1");
                        break;
                    case 'B':
                        if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        }
                        break;
                }
            }
            out.println(d);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BUnhappyHackingABCEdit solver = new BUnhappyHackingABCEdit();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BUnhappyHackingABCEdit solver = new BUnhappyHackingABCEdit();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out LightScanner in = new LightScanner(inputStream); in new LightScanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) BUnhappyHackingABCEdit solver = new BUnhappyHackingABCEdit(); solver new BUnhappyHackingABCEdit() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class BUnhappyHackingABCEdit {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            String s = in.string();
            StringBuilder d = new StringBuilder();
            for (char c : s.toCharArray()) {
                switch (c) {
                    case '0':
                        d.append("0");
                        break;
                    case '1':
                        d.append("1");
                        break;
                    case 'B':
                        if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        }
                        break;
                }
            }
            out.println(d);
        }

    } BUnhappyHackingABCEdit public void solve(int testNumber, LightScanner in, PrintWriter out) {
            String s = in.string();
            StringBuilder d = new StringBuilder();
            for (char c : s.toCharArray()) {
                switch (c) {
                    case '0':
                        d.append("0");
                        break;
                    case '1':
                        d.append("1");
                        break;
                    case 'B':
                        if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        }
                        break;
                }
            }
            out.println(d);
        } solve {
            String s = in.string();
            StringBuilder d = new StringBuilder();
            for (char c : s.toCharArray()) {
                switch (c) {
                    case '0':
                        d.append("0");
                        break;
                    case '1':
                        d.append("1");
                        break;
                    case 'B':
                        if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        }
                        break;
                }
            }
            out.println(d);
        } String s = in.string(); s in.string() in.string in StringBuilder d = new StringBuilder(); d new StringBuilder() for (char c : s.toCharArray()) {
                switch (c) {
                    case '0':
                        d.append("0");
                        break;
                    case '1':
                        d.append("1");
                        break;
                    case 'B':
                        if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        }
                        break;
                }
            } char c s.toCharArray() s.toCharArray s {
                switch (c) {
                    case '0':
                        d.append("0");
                        break;
                    case '1':
                        d.append("1");
                        break;
                    case 'B':
                        if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        }
                        break;
                }
            } {
                switch (c) {
                    case '0':
                        d.append("0");
                        break;
                    case '1':
                        d.append("1");
                        break;
                    case 'B':
                        if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        }
                        break;
                }
            } switch (c) {
                    case '0':
                        d.append("0");
                        break;
                    case '1':
                        d.append("1");
                        break;
                    case 'B':
                        if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        }
                        break;
                } c case '0': '0' case '0': d.append("0") d.append d "0" break; case '1': '1' case '1': d.append("1") d.append d "1" break; case 'B': 'B' case 'B': if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        } d.length() > 0 d.length() d.length d 0 {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        } d.setLength(d.length() - 1) d.setLength d d.length() - 1 d.length() d.length d 1 d.trimToSize() d.trimToSize d break; out.println(d) out.println out d int testNumber testNumber LightScanner in in PrintWriter out out static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

    } LightScanner private BufferedReader reader = null; reader null private StringTokenizer tokenizer = null; tokenizer null public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        } LightScanner {
            reader = new BufferedReader(new InputStreamReader(in));
        } reader = new BufferedReader(new InputStreamReader(in)) reader new BufferedReader(new InputStreamReader(in)) InputStream in in public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        } string {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        } if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            } tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            } try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                } IOException e {
                    throw new UncheckedIOException(e);
                } throw new UncheckedIOException(e); new UncheckedIOException(e) {
                    tokenizer = new StringTokenizer(reader.readLine());
                } tokenizer = new StringTokenizer(reader.readLine()) tokenizer new StringTokenizer(reader.readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BUnhappyHackingABCEdit solver = new BUnhappyHackingABCEdit();
        solver.solve(1, in, out);
        out.close();
    }

    static class BUnhappyHackingABCEdit {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            String s = in.string();
            StringBuilder d = new StringBuilder();
            for (char c : s.toCharArray()) {
                switch (c) {
                    case '0':
                        d.append("0");
                        break;
                    case '1':
                        d.append("1");
                        break;
                    case 'B':
                        if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        }
                        break;
                }
            }
            out.println(d);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BUnhappyHackingABCEdit solver = new BUnhappyHackingABCEdit();
        solver.solve(1, in, out);
        out.close();
    }

    static class BUnhappyHackingABCEdit {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            String s = in.string();
            StringBuilder d = new StringBuilder();
            for (char c : s.toCharArray()) {
                switch (c) {
                    case '0':
                        d.append("0");
                        break;
                    case '1':
                        d.append("1");
                        break;
                    case 'B':
                        if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        }
                        break;
                }
            }
            out.println(d);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BUnhappyHackingABCEdit solver = new BUnhappyHackingABCEdit();
        solver.solve(1, in, out);
        out.close();
    }

    static class BUnhappyHackingABCEdit {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            String s = in.string();
            StringBuilder d = new StringBuilder();
            for (char c : s.toCharArray()) {
                switch (c) {
                    case '0':
                        d.append("0");
                        break;
                    case '1':
                        d.append("1");
                        break;
                    case 'B':
                        if (d.length() > 0) {
                            d.setLength(d.length() - 1);
                            d.trimToSize();
                        }
                        break;
                }
            }
            out.println(d);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}

