import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        LinkedList<Character> display = new LinkedList<>();
        
        for(int i=0;i<s.length();i++){
        	if(s.charAt(i)=='B') display.pollLast();
        	else display.addLast(s.charAt(i));
        }
        for(char c:display) System.out.print(c);
        System.out.println();
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        LinkedList<Character> display = new LinkedList<>();
        
        for(int i=0;i<s.length();i++){
        	if(s.charAt(i)=='B') display.pollLast();
        	else display.addLast(s.charAt(i));
        }
        for(char c:display) System.out.print(c);
        System.out.println();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        LinkedList<Character> display = new LinkedList<>();
        
        for(int i=0;i<s.length();i++){
        	if(s.charAt(i)=='B') display.pollLast();
        	else display.addLast(s.charAt(i));
        }
        for(char c:display) System.out.print(c);
        System.out.println();
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        LinkedList<Character> display = new LinkedList<>();
        
        for(int i=0;i<s.length();i++){
        	if(s.charAt(i)=='B') display.pollLast();
        	else display.addLast(s.charAt(i));
        }
        for(char c:display) System.out.print(c);
        System.out.println();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc LinkedList<Character> display = new LinkedList<>(); display new LinkedList<>() for(int i=0;i<s.length();i++){
        	if(s.charAt(i)=='B') display.pollLast();
        	else display.addLast(s.charAt(i));
        } int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
        	if(s.charAt(i)=='B') display.pollLast();
        	else display.addLast(s.charAt(i));
        } {
        	if(s.charAt(i)=='B') display.pollLast();
        	else display.addLast(s.charAt(i));
        } if(s.charAt(i)=='B') display.pollLast();
        	else display.addLast(s.charAt(i)); s.charAt(i)=='B' s.charAt(i) s.charAt s i 'B' display.pollLast() display.pollLast display display.addLast(s.charAt(i)) display.addLast display s.charAt(i) s.charAt s i for(char c:display) System.out.print(c); char c display System.out.print(c); System.out.print(c) System.out.print System.out System System.out c System.out.println() System.out.println System.out System System.out String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        LinkedList<Character> display = new LinkedList<>();
        
        for(int i=0;i<s.length();i++){
        	if(s.charAt(i)=='B') display.pollLast();
        	else display.addLast(s.charAt(i));
        }
        for(char c:display) System.out.print(c);
        System.out.println();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        LinkedList<Character> display = new LinkedList<>();
        
        for(int i=0;i<s.length();i++){
        	if(s.charAt(i)=='B') display.pollLast();
        	else display.addLast(s.charAt(i));
        }
        for(char c:display) System.out.print(c);
        System.out.println();
    }
} Main
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        LinkedList<Character> display = new LinkedList<>();
        
        for(int i=0;i<s.length();i++){
        	if(s.charAt(i)=='B') display.pollLast();
        	else display.addLast(s.charAt(i));
        }
        for(char c:display) System.out.print(c);
        System.out.println();
    }
}