import java.util.List;
import java.util.Scanner;



public class Main {


	static List<Integer> ansset;

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	String S=sc.next();

    	String[] input=S.split("");

    	String result="";

    	for(int i=0;i<input.length;i++) {

    		if(input[i].equals("B")) {

    			if(result.length()>0) {
    				result=result.substring(0, result.length()-1);
    			}

    		}else {

    			result+=input[i];
    		}

    	}

    	System.out.println(result);

    }
}
 import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {


	static List<Integer> ansset;

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	String S=sc.next();

    	String[] input=S.split("");

    	String result="";

    	for(int i=0;i<input.length;i++) {

    		if(input[i].equals("B")) {

    			if(result.length()>0) {
    				result=result.substring(0, result.length()-1);
    			}

    		}else {

    			result+=input[i];
    		}

    	}

    	System.out.println(result);

    }
} Main static List<Integer> ansset; ansset public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    } main {

    	Main main=new Main();

    	main.run();

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

    	String S=sc.next();

    	String[] input=S.split("");

    	String result="";

    	for(int i=0;i<input.length;i++) {

    		if(input[i].equals("B")) {

    			if(result.length()>0) {
    				result=result.substring(0, result.length()-1);
    			}

    		}else {

    			result+=input[i];
    		}

    	}

    	System.out.println(result);

    } run {
    	Scanner sc=new Scanner(System.in);

    	String S=sc.next();

    	String[] input=S.split("");

    	String result="";

    	for(int i=0;i<input.length;i++) {

    		if(input[i].equals("B")) {

    			if(result.length()>0) {
    				result=result.substring(0, result.length()-1);
    			}

    		}else {

    			result+=input[i];
    		}

    	}

    	System.out.println(result);

    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String S=sc.next(); S sc.next() sc.next sc String[] input=S.split(""); input S.split("") S.split S "" String result=""; result "" for(int i=0;i<input.length;i++) {

    		if(input[i].equals("B")) {

    			if(result.length()>0) {
    				result=result.substring(0, result.length()-1);
    			}

    		}else {

    			result+=input[i];
    		}

    	} int i=0; int i=0; i 0 i<input.length i input.length input input.length i++ i++ i {

    		if(input[i].equals("B")) {

    			if(result.length()>0) {
    				result=result.substring(0, result.length()-1);
    			}

    		}else {

    			result+=input[i];
    		}

    	} {

    		if(input[i].equals("B")) {

    			if(result.length()>0) {
    				result=result.substring(0, result.length()-1);
    			}

    		}else {

    			result+=input[i];
    		}

    	} if(input[i].equals("B")) {

    			if(result.length()>0) {
    				result=result.substring(0, result.length()-1);
    			}

    		}else {

    			result+=input[i];
    		} input[i].equals("B") input[i].equals input[i] input i "B" {

    			if(result.length()>0) {
    				result=result.substring(0, result.length()-1);
    			}

    		} if(result.length()>0) {
    				result=result.substring(0, result.length()-1);
    			} result.length()>0 result.length() result.length result 0 {
    				result=result.substring(0, result.length()-1);
    			} result=result.substring(0, result.length()-1) result result.substring(0, result.length()-1) result.substring result 0 result.length()-1 result.length() result.length result 1 {

    			result+=input[i];
    		} result+=input[i] result input[i] input i System.out.println(result) System.out.println System.out System System.out result public class Main {


	static List<Integer> ansset;

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	String S=sc.next();

    	String[] input=S.split("");

    	String result="";

    	for(int i=0;i<input.length;i++) {

    		if(input[i].equals("B")) {

    			if(result.length()>0) {
    				result=result.substring(0, result.length()-1);
    			}

    		}else {

    			result+=input[i];
    		}

    	}

    	System.out.println(result);

    }
} public class Main {


	static List<Integer> ansset;

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	String S=sc.next();

    	String[] input=S.split("");

    	String result="";

    	for(int i=0;i<input.length;i++) {

    		if(input[i].equals("B")) {

    			if(result.length()>0) {
    				result=result.substring(0, result.length()-1);
    			}

    		}else {

    			result+=input[i];
    		}

    	}

    	System.out.println(result);

    }
} Main
import java.util.List;
import java.util.Scanner;



public class Main {


	static List<Integer> ansset;

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	String S=sc.next();

    	String[] input=S.split("");

    	String result="";

    	for(int i=0;i<input.length;i++) {

    		if(input[i].equals("B")) {

    			if(result.length()>0) {
    				result=result.substring(0, result.length()-1);
    			}

    		}else {

    			result+=input[i];
    		}

    	}

    	System.out.println(result);

    }
}

