import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        char[] d = s.toCharArray();
        StringBuilder sb = new StringBuilder();
        for (char x : d) {
            if (x == '0') {
                sb.append('0');
            }
            if (x == '1') {
                sb.append('1');
            }
            if (x == 'B' && 1 <= sb.length()) {
                sb.deleteCharAt(sb.length()-1);
            }
        }
        System.out.println(sb.toString());
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        char[] d = s.toCharArray();
        StringBuilder sb = new StringBuilder();
        for (char x : d) {
            if (x == '0') {
                sb.append('0');
            }
            if (x == '1') {
                sb.append('1');
            }
            if (x == 'B' && 1 <= sb.length()) {
                sb.deleteCharAt(sb.length()-1);
            }
        }
        System.out.println(sb.toString());
    }
} Main public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    } main {
        Main main = new Main();
        main.solve();
    } Main main = new Main(); main new Main() main.solve() main.solve main String[] args args public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        char[] d = s.toCharArray();
        StringBuilder sb = new StringBuilder();
        for (char x : d) {
            if (x == '0') {
                sb.append('0');
            }
            if (x == '1') {
                sb.append('1');
            }
            if (x == 'B' && 1 <= sb.length()) {
                sb.deleteCharAt(sb.length()-1);
            }
        }
        System.out.println(sb.toString());
    } solve {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        char[] d = s.toCharArray();
        StringBuilder sb = new StringBuilder();
        for (char x : d) {
            if (x == '0') {
                sb.append('0');
            }
            if (x == '1') {
                sb.append('1');
            }
            if (x == 'B' && 1 <= sb.length()) {
                sb.deleteCharAt(sb.length()-1);
            }
        }
        System.out.println(sb.toString());
    } Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in))); scan new Scanner(new BufferedReader(new InputStreamReader(System.in))) String s = scan.next(); s scan.next() scan.next scan char[] d = s.toCharArray(); d s.toCharArray() s.toCharArray s StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (char x : d) {
            if (x == '0') {
                sb.append('0');
            }
            if (x == '1') {
                sb.append('1');
            }
            if (x == 'B' && 1 <= sb.length()) {
                sb.deleteCharAt(sb.length()-1);
            }
        } char x d {
            if (x == '0') {
                sb.append('0');
            }
            if (x == '1') {
                sb.append('1');
            }
            if (x == 'B' && 1 <= sb.length()) {
                sb.deleteCharAt(sb.length()-1);
            }
        } {
            if (x == '0') {
                sb.append('0');
            }
            if (x == '1') {
                sb.append('1');
            }
            if (x == 'B' && 1 <= sb.length()) {
                sb.deleteCharAt(sb.length()-1);
            }
        } if (x == '0') {
                sb.append('0');
            } x == '0' x '0' {
                sb.append('0');
            } sb.append('0') sb.append sb '0' if (x == '1') {
                sb.append('1');
            } x == '1' x '1' {
                sb.append('1');
            } sb.append('1') sb.append sb '1' if (x == 'B' && 1 <= sb.length()) {
                sb.deleteCharAt(sb.length()-1);
            } x == 'B' && 1 <= sb.length() x == 'B' x 'B' 1 <= sb.length() 1 sb.length() sb.length sb {
                sb.deleteCharAt(sb.length()-1);
            } sb.deleteCharAt(sb.length()-1) sb.deleteCharAt 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 {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        char[] d = s.toCharArray();
        StringBuilder sb = new StringBuilder();
        for (char x : d) {
            if (x == '0') {
                sb.append('0');
            }
            if (x == '1') {
                sb.append('1');
            }
            if (x == 'B' && 1 <= sb.length()) {
                sb.deleteCharAt(sb.length()-1);
            }
        }
        System.out.println(sb.toString());
    }
} public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        char[] d = s.toCharArray();
        StringBuilder sb = new StringBuilder();
        for (char x : d) {
            if (x == '0') {
                sb.append('0');
            }
            if (x == '1') {
                sb.append('1');
            }
            if (x == 'B' && 1 <= sb.length()) {
                sb.deleteCharAt(sb.length()-1);
            }
        }
        System.out.println(sb.toString());
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        char[] d = s.toCharArray();
        StringBuilder sb = new StringBuilder();
        for (char x : d) {
            if (x == '0') {
                sb.append('0');
            }
            if (x == '1') {
                sb.append('1');
            }
            if (x == 'B' && 1 <= sb.length()) {
                sb.deleteCharAt(sb.length()-1);
            }
        }
        System.out.println(sb.toString());
    }
}
