import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            String s = in.next();

            StringBuilder screen = new StringBuilder();
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == 'B') {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } else {
                    screen.append(c);
                }
            }

            System.out.println(screen.toString());
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            String s = in.next();

            StringBuilder screen = new StringBuilder();
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == 'B') {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } else {
                    screen.append(c);
                }
            }

            System.out.println(screen.toString());
        }
    }
} Main public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            String s = in.next();

            StringBuilder screen = new StringBuilder();
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == 'B') {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } else {
                    screen.append(c);
                }
            }

            System.out.println(screen.toString());
        }
    } main {
        try (Scanner in = new Scanner(System.in)) {
            String s = in.next();

            StringBuilder screen = new StringBuilder();
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == 'B') {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } else {
                    screen.append(c);
                }
            }

            System.out.println(screen.toString());
        }
    } try (Scanner in = new Scanner(System.in)) {
            String s = in.next();

            StringBuilder screen = new StringBuilder();
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == 'B') {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } else {
                    screen.append(c);
                }
            }

            System.out.println(screen.toString());
        } {
            String s = in.next();

            StringBuilder screen = new StringBuilder();
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == 'B') {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } else {
                    screen.append(c);
                }
            }

            System.out.println(screen.toString());
        } Scanner in = new Scanner(System.in) Scanner in = new Scanner(System.in) new Scanner(System.in) String s = in.next(); s in.next() in.next in StringBuilder screen = new StringBuilder(); screen new StringBuilder() for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == 'B') {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } else {
                    screen.append(c);
                }
            } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
                char c = s.charAt(i);
                if (c == 'B') {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } else {
                    screen.append(c);
                }
            } {
                char c = s.charAt(i);
                if (c == 'B') {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } else {
                    screen.append(c);
                }
            } char c = s.charAt(i); c s.charAt(i) s.charAt s i if (c == 'B') {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } else {
                    screen.append(c);
                } c == 'B' c 'B' {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    } screen.length() > 0 screen.length() screen.length screen 0 {
                        screen.setLength(screen.length() - 1);
                    } screen.setLength(screen.length() - 1) screen.setLength screen screen.length() - 1 screen.length() screen.length screen 1 {
                    screen.append(c);
                } screen.append(c) screen.append screen c System.out.println(screen.toString()) System.out.println System.out System System.out screen.toString() screen.toString screen String[] args args public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            String s = in.next();

            StringBuilder screen = new StringBuilder();
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == 'B') {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } else {
                    screen.append(c);
                }
            }

            System.out.println(screen.toString());
        }
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            String s = in.next();

            StringBuilder screen = new StringBuilder();
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == 'B') {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } else {
                    screen.append(c);
                }
            }

            System.out.println(screen.toString());
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            String s = in.next();

            StringBuilder screen = new StringBuilder();
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == 'B') {
                    if (screen.length() > 0) {
                        screen.setLength(screen.length() - 1);
                    }
                } else {
                    screen.append(c);
                }
            }

            System.out.println(screen.toString());
        }
    }
}
