import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        char[] arr = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();

        for (int i=0; i<arr.length; i++) {
            if (arr[i] != 'B') {
                sb.append(arr[i]);
            } else {
                if (sb.length() != 0) {
                    sb.setLength(sb.length() - 1);
                }
            }
        }

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

}
 import java.util.*; util.* java public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        char[] arr = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();

        for (int i=0; i<arr.length; i++) {
            if (arr[i] != 'B') {
                sb.append(arr[i]);
            } else {
                if (sb.length() != 0) {
                    sb.setLength(sb.length() - 1);
                }
            }
        }

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

} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() String[] args args void run() {

        char[] arr = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();

        for (int i=0; i<arr.length; i++) {
            if (arr[i] != 'B') {
                sb.append(arr[i]);
            } else {
                if (sb.length() != 0) {
                    sb.setLength(sb.length() - 1);
                }
            }
        }

        System.out.println(sb.toString());
    } run {

        char[] arr = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();

        for (int i=0; i<arr.length; i++) {
            if (arr[i] != 'B') {
                sb.append(arr[i]);
            } else {
                if (sb.length() != 0) {
                    sb.setLength(sb.length() - 1);
                }
            }
        }

        System.out.println(sb.toString());
    } char[] arr = sc.next().toCharArray(); arr sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i=0; i<arr.length; i++) {
            if (arr[i] != 'B') {
                sb.append(arr[i]);
            } else {
                if (sb.length() != 0) {
                    sb.setLength(sb.length() - 1);
                }
            }
        } int i=0; int i=0; i 0 i<arr.length i arr.length arr arr.length i++ i++ i {
            if (arr[i] != 'B') {
                sb.append(arr[i]);
            } else {
                if (sb.length() != 0) {
                    sb.setLength(sb.length() - 1);
                }
            }
        } {
            if (arr[i] != 'B') {
                sb.append(arr[i]);
            } else {
                if (sb.length() != 0) {
                    sb.setLength(sb.length() - 1);
                }
            }
        } if (arr[i] != 'B') {
                sb.append(arr[i]);
            } else {
                if (sb.length() != 0) {
                    sb.setLength(sb.length() - 1);
                }
            } arr[i] != 'B' arr[i] arr i 'B' {
                sb.append(arr[i]);
            } sb.append(arr[i]) sb.append sb arr[i] arr i {
                if (sb.length() != 0) {
                    sb.setLength(sb.length() - 1);
                }
            } if (sb.length() != 0) {
                    sb.setLength(sb.length() - 1);
                } sb.length() != 0 sb.length() sb.length sb 0 {
                    sb.setLength(sb.length() - 1);
                } sb.setLength(sb.length() - 1) sb.setLength sb sb.length() - 1 sb.length() sb.length sb 1 System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        char[] arr = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();

        for (int i=0; i<arr.length; i++) {
            if (arr[i] != 'B') {
                sb.append(arr[i]);
            } else {
                if (sb.length() != 0) {
                    sb.setLength(sb.length() - 1);
                }
            }
        }

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

} public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        char[] arr = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();

        for (int i=0; i<arr.length; i++) {
            if (arr[i] != 'B') {
                sb.append(arr[i]);
            } else {
                if (sb.length() != 0) {
                    sb.setLength(sb.length() - 1);
                }
            }
        }

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

} Main
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        char[] arr = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();

        for (int i=0; i<arr.length; i++) {
            if (arr[i] != 'B') {
                sb.append(arr[i]);
            } else {
                if (sb.length() != 0) {
                    sb.setLength(sb.length() - 1);
                }
            }
        }

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

}

