import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
    public static void main(String[] args) throws IOException {
        try (PrintWriter writer = new PrintWriter(System.out); InputReader reader = new InputReader(System.in)) {
            solve(writer, reader);
        }
    }

    private static void solve(PrintWriter writer, InputReader reader) throws IOException {
        String input = reader.readLine();
        StringBuilder sb = new StringBuilder(input.length());

        for (char c : input.toCharArray()) {
            switch (c) {
                case 'B':
                    if (sb.length() == 0) {
                        break;
                    }

                    sb.deleteCharAt(sb.length() - 1);
                    break;
                default:
                    sb.append(c);
            }
        }

        writer.println(sb);
        writer.flush();
    }
}

class Util {
    static int gcd(int m, int n) {
        int min = Math.min(m, n);
        int max = Math.max(m, n);
        while (min != 0) {
            int tmp = min;
            min = max % tmp;
            max = tmp;
        }

        return max;
    }
}

class InputReader implements Closeable, AutoCloseable {
    private final BufferedReader br;

    InputReader(InputStream inputStream) {
        this.br = new BufferedReader(new InputStreamReader(inputStream));
    }

    String readLine() throws IOException {
        return this.br.readLine();
    }

    int readInt() throws IOException {
        return Integer.parseInt(this.readLine());
    }

    long readLong() throws IOException {
        return Long.parseLong(this.readLine());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(this.readLine());
    }

    String[] readStringsSplitByDelimiter(String delimiter) throws IOException {
        return this.readLine().split(delimiter);
    }

    int[] readIntsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        int[] ints = new int[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            ints[i] = Integer.parseInt(strings[i]);
        }

        return ints;
    }

    long[] readLongsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        long[] longs = new long[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            longs[i] = Long.parseLong(strings[i]);
        }

        return longs;
    }

    double[] readDoublesSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        double[] doubles = new double[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            doubles[i] = Double.parseDouble(strings[i]);
        }

        return doubles;
    }

    @Override
    public void close() throws IOException {
        this.br.close();
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.Closeable; Closeable java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io public class Main {
    public static void main(String[] args) throws IOException {
        try (PrintWriter writer = new PrintWriter(System.out); InputReader reader = new InputReader(System.in)) {
            solve(writer, reader);
        }
    }

    private static void solve(PrintWriter writer, InputReader reader) throws IOException {
        String input = reader.readLine();
        StringBuilder sb = new StringBuilder(input.length());

        for (char c : input.toCharArray()) {
            switch (c) {
                case 'B':
                    if (sb.length() == 0) {
                        break;
                    }

                    sb.deleteCharAt(sb.length() - 1);
                    break;
                default:
                    sb.append(c);
            }
        }

        writer.println(sb);
        writer.flush();
    }
} Main public static void main(String[] args) throws IOException {
        try (PrintWriter writer = new PrintWriter(System.out); InputReader reader = new InputReader(System.in)) {
            solve(writer, reader);
        }
    } main {
        try (PrintWriter writer = new PrintWriter(System.out); InputReader reader = new InputReader(System.in)) {
            solve(writer, reader);
        }
    } try (PrintWriter writer = new PrintWriter(System.out); InputReader reader = new InputReader(System.in)) {
            solve(writer, reader);
        } {
            solve(writer, reader);
        } PrintWriter writer = new PrintWriter(System.out) PrintWriter writer = new PrintWriter(System.out) new PrintWriter(System.out) InputReader reader = new InputReader(System.in) InputReader reader = new InputReader(System.in) new InputReader(System.in) solve(writer, reader) solve writer reader String[] args args private static void solve(PrintWriter writer, InputReader reader) throws IOException {
        String input = reader.readLine();
        StringBuilder sb = new StringBuilder(input.length());

        for (char c : input.toCharArray()) {
            switch (c) {
                case 'B':
                    if (sb.length() == 0) {
                        break;
                    }

                    sb.deleteCharAt(sb.length() - 1);
                    break;
                default:
                    sb.append(c);
            }
        }

        writer.println(sb);
        writer.flush();
    } solve {
        String input = reader.readLine();
        StringBuilder sb = new StringBuilder(input.length());

        for (char c : input.toCharArray()) {
            switch (c) {
                case 'B':
                    if (sb.length() == 0) {
                        break;
                    }

                    sb.deleteCharAt(sb.length() - 1);
                    break;
                default:
                    sb.append(c);
            }
        }

        writer.println(sb);
        writer.flush();
    } String input = reader.readLine(); input reader.readLine() reader.readLine reader StringBuilder sb = new StringBuilder(input.length()); sb new StringBuilder(input.length()) for (char c : input.toCharArray()) {
            switch (c) {
                case 'B':
                    if (sb.length() == 0) {
                        break;
                    }

                    sb.deleteCharAt(sb.length() - 1);
                    break;
                default:
                    sb.append(c);
            }
        } char c input.toCharArray() input.toCharArray input {
            switch (c) {
                case 'B':
                    if (sb.length() == 0) {
                        break;
                    }

                    sb.deleteCharAt(sb.length() - 1);
                    break;
                default:
                    sb.append(c);
            }
        } {
            switch (c) {
                case 'B':
                    if (sb.length() == 0) {
                        break;
                    }

                    sb.deleteCharAt(sb.length() - 1);
                    break;
                default:
                    sb.append(c);
            }
        } switch (c) {
                case 'B':
                    if (sb.length() == 0) {
                        break;
                    }

                    sb.deleteCharAt(sb.length() - 1);
                    break;
                default:
                    sb.append(c);
            } c case 'B': 'B' case 'B': if (sb.length() == 0) {
                        break;
                    } sb.length() == 0 sb.length() sb.length sb 0 {
                        break;
                    } break; sb.deleteCharAt(sb.length() - 1) sb.deleteCharAt sb sb.length() - 1 sb.length() sb.length sb 1 break; default: default: sb.append(c) sb.append sb c writer.println(sb) writer.println writer sb writer.flush() writer.flush writer PrintWriter writer writer InputReader reader reader class Util {
    static int gcd(int m, int n) {
        int min = Math.min(m, n);
        int max = Math.max(m, n);
        while (min != 0) {
            int tmp = min;
            min = max % tmp;
            max = tmp;
        }

        return max;
    }
} Util static int gcd(int m, int n) {
        int min = Math.min(m, n);
        int max = Math.max(m, n);
        while (min != 0) {
            int tmp = min;
            min = max % tmp;
            max = tmp;
        }

        return max;
    } gcd {
        int min = Math.min(m, n);
        int max = Math.max(m, n);
        while (min != 0) {
            int tmp = min;
            min = max % tmp;
            max = tmp;
        }

        return max;
    } int min = Math.min(m, n); min Math.min(m, n) Math.min Math m n int max = Math.max(m, n); max Math.max(m, n) Math.max Math m n while (min != 0) {
            int tmp = min;
            min = max % tmp;
            max = tmp;
        } min != 0 min 0 {
            int tmp = min;
            min = max % tmp;
            max = tmp;
        } int tmp = min; tmp min min = max % tmp min max % tmp max tmp max = tmp max tmp return max; max int m m int n n class InputReader implements Closeable, AutoCloseable {
    private final BufferedReader br;

    InputReader(InputStream inputStream) {
        this.br = new BufferedReader(new InputStreamReader(inputStream));
    }

    String readLine() throws IOException {
        return this.br.readLine();
    }

    int readInt() throws IOException {
        return Integer.parseInt(this.readLine());
    }

    long readLong() throws IOException {
        return Long.parseLong(this.readLine());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(this.readLine());
    }

    String[] readStringsSplitByDelimiter(String delimiter) throws IOException {
        return this.readLine().split(delimiter);
    }

    int[] readIntsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        int[] ints = new int[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            ints[i] = Integer.parseInt(strings[i]);
        }

        return ints;
    }

    long[] readLongsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        long[] longs = new long[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            longs[i] = Long.parseLong(strings[i]);
        }

        return longs;
    }

    double[] readDoublesSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        double[] doubles = new double[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            doubles[i] = Double.parseDouble(strings[i]);
        }

        return doubles;
    }

    @Override
    public void close() throws IOException {
        this.br.close();
    }
} InputReader private final BufferedReader br; br InputReader(InputStream inputStream) {
        this.br = new BufferedReader(new InputStreamReader(inputStream));
    } InputReader {
        this.br = new BufferedReader(new InputStreamReader(inputStream));
    } this.br = new BufferedReader(new InputStreamReader(inputStream)) this.br this this.br new BufferedReader(new InputStreamReader(inputStream)) InputStream inputStream inputStream String readLine() throws IOException {
        return this.br.readLine();
    } readLine {
        return this.br.readLine();
    } return this.br.readLine(); this.br.readLine() this.br.readLine this.br this this.br int readInt() throws IOException {
        return Integer.parseInt(this.readLine());
    } readInt {
        return Integer.parseInt(this.readLine());
    } return Integer.parseInt(this.readLine()); Integer.parseInt(this.readLine()) Integer.parseInt Integer this.readLine() this.readLine this long readLong() throws IOException {
        return Long.parseLong(this.readLine());
    } readLong {
        return Long.parseLong(this.readLine());
    } return Long.parseLong(this.readLine()); Long.parseLong(this.readLine()) Long.parseLong Long this.readLine() this.readLine this double readDouble() throws IOException {
        return Double.parseDouble(this.readLine());
    } readDouble {
        return Double.parseDouble(this.readLine());
    } return Double.parseDouble(this.readLine()); Double.parseDouble(this.readLine()) Double.parseDouble Double this.readLine() this.readLine this String[] readStringsSplitByDelimiter(String delimiter) throws IOException {
        return this.readLine().split(delimiter);
    } readStringsSplitByDelimiter {
        return this.readLine().split(delimiter);
    } return this.readLine().split(delimiter); this.readLine().split(delimiter) this.readLine().split this.readLine() this.readLine this delimiter String delimiter delimiter int[] readIntsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        int[] ints = new int[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            ints[i] = Integer.parseInt(strings[i]);
        }

        return ints;
    } readIntsSplitByDelimiter {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        int[] ints = new int[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            ints[i] = Integer.parseInt(strings[i]);
        }

        return ints;
    } String[] strings = this.readStringsSplitByDelimiter(delimiter); strings this.readStringsSplitByDelimiter(delimiter) this.readStringsSplitByDelimiter this delimiter int stringsLength = strings.length; stringsLength strings.length strings strings.length int[] ints = new int[stringsLength]; ints new int[stringsLength] stringsLength for (int i = 0; i < stringsLength; i++) {
            ints[i] = Integer.parseInt(strings[i]);
        } int i = 0; int i = 0; i 0 i < stringsLength i stringsLength i++ i++ i {
            ints[i] = Integer.parseInt(strings[i]);
        } {
            ints[i] = Integer.parseInt(strings[i]);
        } ints[i] = Integer.parseInt(strings[i]) ints[i] ints i Integer.parseInt(strings[i]) Integer.parseInt Integer strings[i] strings i return ints; ints String delimiter delimiter long[] readLongsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        long[] longs = new long[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            longs[i] = Long.parseLong(strings[i]);
        }

        return longs;
    } readLongsSplitByDelimiter {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        long[] longs = new long[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            longs[i] = Long.parseLong(strings[i]);
        }

        return longs;
    } String[] strings = this.readStringsSplitByDelimiter(delimiter); strings this.readStringsSplitByDelimiter(delimiter) this.readStringsSplitByDelimiter this delimiter int stringsLength = strings.length; stringsLength strings.length strings strings.length long[] longs = new long[stringsLength]; longs new long[stringsLength] stringsLength for (int i = 0; i < stringsLength; i++) {
            longs[i] = Long.parseLong(strings[i]);
        } int i = 0; int i = 0; i 0 i < stringsLength i stringsLength i++ i++ i {
            longs[i] = Long.parseLong(strings[i]);
        } {
            longs[i] = Long.parseLong(strings[i]);
        } longs[i] = Long.parseLong(strings[i]) longs[i] longs i Long.parseLong(strings[i]) Long.parseLong Long strings[i] strings i return longs; longs String delimiter delimiter double[] readDoublesSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        double[] doubles = new double[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            doubles[i] = Double.parseDouble(strings[i]);
        }

        return doubles;
    } readDoublesSplitByDelimiter {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        double[] doubles = new double[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            doubles[i] = Double.parseDouble(strings[i]);
        }

        return doubles;
    } String[] strings = this.readStringsSplitByDelimiter(delimiter); strings this.readStringsSplitByDelimiter(delimiter) this.readStringsSplitByDelimiter this delimiter int stringsLength = strings.length; stringsLength strings.length strings strings.length double[] doubles = new double[stringsLength]; doubles new double[stringsLength] stringsLength for (int i = 0; i < stringsLength; i++) {
            doubles[i] = Double.parseDouble(strings[i]);
        } int i = 0; int i = 0; i 0 i < stringsLength i stringsLength i++ i++ i {
            doubles[i] = Double.parseDouble(strings[i]);
        } {
            doubles[i] = Double.parseDouble(strings[i]);
        } doubles[i] = Double.parseDouble(strings[i]) doubles[i] doubles i Double.parseDouble(strings[i]) Double.parseDouble Double strings[i] strings i return doubles; doubles String delimiter delimiter @Override
    public void close() throws IOException {
        this.br.close();
    } close {
        this.br.close();
    } this.br.close() this.br.close this.br this this.br Closeable AutoCloseable public class Main {
    public static void main(String[] args) throws IOException {
        try (PrintWriter writer = new PrintWriter(System.out); InputReader reader = new InputReader(System.in)) {
            solve(writer, reader);
        }
    }

    private static void solve(PrintWriter writer, InputReader reader) throws IOException {
        String input = reader.readLine();
        StringBuilder sb = new StringBuilder(input.length());

        for (char c : input.toCharArray()) {
            switch (c) {
                case 'B':
                    if (sb.length() == 0) {
                        break;
                    }

                    sb.deleteCharAt(sb.length() - 1);
                    break;
                default:
                    sb.append(c);
            }
        }

        writer.println(sb);
        writer.flush();
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        try (PrintWriter writer = new PrintWriter(System.out); InputReader reader = new InputReader(System.in)) {
            solve(writer, reader);
        }
    }

    private static void solve(PrintWriter writer, InputReader reader) throws IOException {
        String input = reader.readLine();
        StringBuilder sb = new StringBuilder(input.length());

        for (char c : input.toCharArray()) {
            switch (c) {
                case 'B':
                    if (sb.length() == 0) {
                        break;
                    }

                    sb.deleteCharAt(sb.length() - 1);
                    break;
                default:
                    sb.append(c);
            }
        }

        writer.println(sb);
        writer.flush();
    }
} Main
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
    public static void main(String[] args) throws IOException {
        try (PrintWriter writer = new PrintWriter(System.out); InputReader reader = new InputReader(System.in)) {
            solve(writer, reader);
        }
    }

    private static void solve(PrintWriter writer, InputReader reader) throws IOException {
        String input = reader.readLine();
        StringBuilder sb = new StringBuilder(input.length());

        for (char c : input.toCharArray()) {
            switch (c) {
                case 'B':
                    if (sb.length() == 0) {
                        break;
                    }

                    sb.deleteCharAt(sb.length() - 1);
                    break;
                default:
                    sb.append(c);
            }
        }

        writer.println(sb);
        writer.flush();
    }
}

class Util {
    static int gcd(int m, int n) {
        int min = Math.min(m, n);
        int max = Math.max(m, n);
        while (min != 0) {
            int tmp = min;
            min = max % tmp;
            max = tmp;
        }

        return max;
    }
}

class InputReader implements Closeable, AutoCloseable {
    private final BufferedReader br;

    InputReader(InputStream inputStream) {
        this.br = new BufferedReader(new InputStreamReader(inputStream));
    }

    String readLine() throws IOException {
        return this.br.readLine();
    }

    int readInt() throws IOException {
        return Integer.parseInt(this.readLine());
    }

    long readLong() throws IOException {
        return Long.parseLong(this.readLine());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(this.readLine());
    }

    String[] readStringsSplitByDelimiter(String delimiter) throws IOException {
        return this.readLine().split(delimiter);
    }

    int[] readIntsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        int[] ints = new int[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            ints[i] = Integer.parseInt(strings[i]);
        }

        return ints;
    }

    long[] readLongsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        long[] longs = new long[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            longs[i] = Long.parseLong(strings[i]);
        }

        return longs;
    }

    double[] readDoublesSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        double[] doubles = new double[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            doubles[i] = Double.parseDouble(strings[i]);
        }

        return doubles;
    }

    @Override
    public void close() throws IOException {
        this.br.close();
    }
}
