

import java.util.Scanner;
import java.util.Stack;


public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        char[] s = sc.next().toCharArray();
        Stack<Character> stack = new Stack<>();
        for (int i = 0; i < s.length; i++) {
            if (s[i] != 'B') {
                stack.push(s[i]);
            } else {
                if (stack.size() > 0) {
                    stack.pop();
                }
            }
        }
        String ans = "";
        for (int i = 0; i < stack.size(); i++) {
            ans += stack.get(i);
        }
        System.out.println(ans);
    }

} import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        char[] s = sc.next().toCharArray();
        Stack<Character> stack = new Stack<>();
        for (int i = 0; i < s.length; i++) {
            if (s[i] != 'B') {
                stack.push(s[i]);
            } else {
                if (stack.size() > 0) {
                    stack.pop();
                }
            }
        }
        String ans = "";
        for (int i = 0; i < stack.size(); i++) {
            ans += stack.get(i);
        }
        System.out.println(ans);
    }

} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        char[] s = sc.next().toCharArray();
        Stack<Character> stack = new Stack<>();
        for (int i = 0; i < s.length; i++) {
            if (s[i] != 'B') {
                stack.push(s[i]);
            } else {
                if (stack.size() > 0) {
                    stack.pop();
                }
            }
        }
        String ans = "";
        for (int i = 0; i < stack.size(); i++) {
            ans += stack.get(i);
        }
        System.out.println(ans);
    } main {
        char[] s = sc.next().toCharArray();
        Stack<Character> stack = new Stack<>();
        for (int i = 0; i < s.length; i++) {
            if (s[i] != 'B') {
                stack.push(s[i]);
            } else {
                if (stack.size() > 0) {
                    stack.pop();
                }
            }
        }
        String ans = "";
        for (int i = 0; i < stack.size(); i++) {
            ans += stack.get(i);
        }
        System.out.println(ans);
    } char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Stack<Character> stack = new Stack<>(); stack new Stack<>() for (int i = 0; i < s.length; i++) {
            if (s[i] != 'B') {
                stack.push(s[i]);
            } else {
                if (stack.size() > 0) {
                    stack.pop();
                }
            }
        } int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
            if (s[i] != 'B') {
                stack.push(s[i]);
            } else {
                if (stack.size() > 0) {
                    stack.pop();
                }
            }
        } {
            if (s[i] != 'B') {
                stack.push(s[i]);
            } else {
                if (stack.size() > 0) {
                    stack.pop();
                }
            }
        } if (s[i] != 'B') {
                stack.push(s[i]);
            } else {
                if (stack.size() > 0) {
                    stack.pop();
                }
            } s[i] != 'B' s[i] s i 'B' {
                stack.push(s[i]);
            } stack.push(s[i]) stack.push stack s[i] s i {
                if (stack.size() > 0) {
                    stack.pop();
                }
            } if (stack.size() > 0) {
                    stack.pop();
                } stack.size() > 0 stack.size() stack.size stack 0 {
                    stack.pop();
                } stack.pop() stack.pop stack String ans = ""; ans "" for (int i = 0; i < stack.size(); i++) {
            ans += stack.get(i);
        } int i = 0; int i = 0; i 0 i < stack.size() i stack.size() stack.size stack i++ i++ i {
            ans += stack.get(i);
        } {
            ans += stack.get(i);
        } ans += stack.get(i) ans stack.get(i) stack.get stack i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        char[] s = sc.next().toCharArray();
        Stack<Character> stack = new Stack<>();
        for (int i = 0; i < s.length; i++) {
            if (s[i] != 'B') {
                stack.push(s[i]);
            } else {
                if (stack.size() > 0) {
                    stack.pop();
                }
            }
        }
        String ans = "";
        for (int i = 0; i < stack.size(); i++) {
            ans += stack.get(i);
        }
        System.out.println(ans);
    }

} public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        char[] s = sc.next().toCharArray();
        Stack<Character> stack = new Stack<>();
        for (int i = 0; i < s.length; i++) {
            if (s[i] != 'B') {
                stack.push(s[i]);
            } else {
                if (stack.size() > 0) {
                    stack.pop();
                }
            }
        }
        String ans = "";
        for (int i = 0; i < stack.size(); i++) {
            ans += stack.get(i);
        }
        System.out.println(ans);
    }

} Main


import java.util.Scanner;
import java.util.Stack;


public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        char[] s = sc.next().toCharArray();
        Stack<Character> stack = new Stack<>();
        for (int i = 0; i < s.length; i++) {
            if (s[i] != 'B') {
                stack.push(s[i]);
            } else {
                if (stack.size() > 0) {
                    stack.pop();
                }
            }
        }
        String ans = "";
        for (int i = 0; i < stack.size(); i++) {
            ans += stack.get(i);
        }
        System.out.println(ans);
    }

}
