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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        Stack<Character> stack = new Stack<>();
        for(Character c : input.toCharArray()){
            if(c != 'B')
                stack.push(c);
            else{
                if(!stack.empty())
                    stack.pop();
            }
        }
        StringBuilder result = new StringBuilder("");
        while(!stack.empty()){
            result.append(stack.pop());
        }
        result.reverse();
        System.out.println(result.toString());
    }
} import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        Stack<Character> stack = new Stack<>();
        for(Character c : input.toCharArray()){
            if(c != 'B')
                stack.push(c);
            else{
                if(!stack.empty())
                    stack.pop();
            }
        }
        StringBuilder result = new StringBuilder("");
        while(!stack.empty()){
            result.append(stack.pop());
        }
        result.reverse();
        System.out.println(result.toString());
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        Stack<Character> stack = new Stack<>();
        for(Character c : input.toCharArray()){
            if(c != 'B')
                stack.push(c);
            else{
                if(!stack.empty())
                    stack.pop();
            }
        }
        StringBuilder result = new StringBuilder("");
        while(!stack.empty()){
            result.append(stack.pop());
        }
        result.reverse();
        System.out.println(result.toString());
    } main {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        Stack<Character> stack = new Stack<>();
        for(Character c : input.toCharArray()){
            if(c != 'B')
                stack.push(c);
            else{
                if(!stack.empty())
                    stack.pop();
            }
        }
        StringBuilder result = new StringBuilder("");
        while(!stack.empty()){
            result.append(stack.pop());
        }
        result.reverse();
        System.out.println(result.toString());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String input = sc.next(); input sc.next() sc.next sc Stack<Character> stack = new Stack<>(); stack new Stack<>() for(Character c : input.toCharArray()){
            if(c != 'B')
                stack.push(c);
            else{
                if(!stack.empty())
                    stack.pop();
            }
        } Character c input.toCharArray() input.toCharArray input {
            if(c != 'B')
                stack.push(c);
            else{
                if(!stack.empty())
                    stack.pop();
            }
        } {
            if(c != 'B')
                stack.push(c);
            else{
                if(!stack.empty())
                    stack.pop();
            }
        } if(c != 'B')
                stack.push(c);
            else{
                if(!stack.empty())
                    stack.pop();
            } c != 'B' c 'B' stack.push(c) stack.push stack c {
                if(!stack.empty())
                    stack.pop();
            } if(!stack.empty())
                    stack.pop(); !stack.empty() stack.empty() stack.empty stack stack.pop() stack.pop stack StringBuilder result = new StringBuilder(""); result new StringBuilder("") while(!stack.empty()){
            result.append(stack.pop());
        } !stack.empty() stack.empty() stack.empty stack {
            result.append(stack.pop());
        } result.append(stack.pop()) result.append result stack.pop() stack.pop stack result.reverse() result.reverse result System.out.println(result.toString()) System.out.println System.out System System.out result.toString() result.toString result String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        Stack<Character> stack = new Stack<>();
        for(Character c : input.toCharArray()){
            if(c != 'B')
                stack.push(c);
            else{
                if(!stack.empty())
                    stack.pop();
            }
        }
        StringBuilder result = new StringBuilder("");
        while(!stack.empty()){
            result.append(stack.pop());
        }
        result.reverse();
        System.out.println(result.toString());
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        Stack<Character> stack = new Stack<>();
        for(Character c : input.toCharArray()){
            if(c != 'B')
                stack.push(c);
            else{
                if(!stack.empty())
                    stack.pop();
            }
        }
        StringBuilder result = new StringBuilder("");
        while(!stack.empty()){
            result.append(stack.pop());
        }
        result.reverse();
        System.out.println(result.toString());
    }
} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        Stack<Character> stack = new Stack<>();
        for(Character c : input.toCharArray()){
            if(c != 'B')
                stack.push(c);
            else{
                if(!stack.empty())
                    stack.pop();
            }
        }
        StringBuilder result = new StringBuilder("");
        while(!stack.empty()){
            result.append(stack.pop());
        }
        result.reverse();
        System.out.println(result.toString());
    }
}
