/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/
import java.util.Scanner;
 class Main
{
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String input = sc.nextLine();
		
		StringBuilder output = new StringBuilder();
		
		for (int i=0; i<input.length(); ++i) {
		    
		    if (input.charAt(i) != 'B') {
		        output.append(input.charAt(i));
		    }else {
		        int len = output.length();
		        if (len > 0) {
		            output.deleteCharAt(len-1);
		        }
		    }
		}
		
		sc.close();
		System.out.println(output);
	}
} import java.util.Scanner; Scanner java.util class Main
{
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String input = sc.nextLine();
		
		StringBuilder output = new StringBuilder();
		
		for (int i=0; i<input.length(); ++i) {
		    
		    if (input.charAt(i) != 'B') {
		        output.append(input.charAt(i));
		    }else {
		        int len = output.length();
		        if (len > 0) {
		            output.deleteCharAt(len-1);
		        }
		    }
		}
		
		sc.close();
		System.out.println(output);
	}
} Main public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String input = sc.nextLine();
		
		StringBuilder output = new StringBuilder();
		
		for (int i=0; i<input.length(); ++i) {
		    
		    if (input.charAt(i) != 'B') {
		        output.append(input.charAt(i));
		    }else {
		        int len = output.length();
		        if (len > 0) {
		            output.deleteCharAt(len-1);
		        }
		    }
		}
		
		sc.close();
		System.out.println(output);
	} main {
		
		Scanner sc = new Scanner(System.in);
		
		String input = sc.nextLine();
		
		StringBuilder output = new StringBuilder();
		
		for (int i=0; i<input.length(); ++i) {
		    
		    if (input.charAt(i) != 'B') {
		        output.append(input.charAt(i));
		    }else {
		        int len = output.length();
		        if (len > 0) {
		            output.deleteCharAt(len-1);
		        }
		    }
		}
		
		sc.close();
		System.out.println(output);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String input = sc.nextLine(); input sc.nextLine() sc.nextLine sc StringBuilder output = new StringBuilder(); output new StringBuilder() for (int i=0; i<input.length(); ++i) {
		    
		    if (input.charAt(i) != 'B') {
		        output.append(input.charAt(i));
		    }else {
		        int len = output.length();
		        if (len > 0) {
		            output.deleteCharAt(len-1);
		        }
		    }
		} int i=0; int i=0; i 0 i<input.length() i input.length() input.length input ++i ++i i {
		    
		    if (input.charAt(i) != 'B') {
		        output.append(input.charAt(i));
		    }else {
		        int len = output.length();
		        if (len > 0) {
		            output.deleteCharAt(len-1);
		        }
		    }
		} {
		    
		    if (input.charAt(i) != 'B') {
		        output.append(input.charAt(i));
		    }else {
		        int len = output.length();
		        if (len > 0) {
		            output.deleteCharAt(len-1);
		        }
		    }
		} if (input.charAt(i) != 'B') {
		        output.append(input.charAt(i));
		    }else {
		        int len = output.length();
		        if (len > 0) {
		            output.deleteCharAt(len-1);
		        }
		    } input.charAt(i) != 'B' input.charAt(i) input.charAt input i 'B' {
		        output.append(input.charAt(i));
		    } output.append(input.charAt(i)) output.append output input.charAt(i) input.charAt input i {
		        int len = output.length();
		        if (len > 0) {
		            output.deleteCharAt(len-1);
		        }
		    } int len = output.length(); len output.length() output.length output if (len > 0) {
		            output.deleteCharAt(len-1);
		        } len > 0 len 0 {
		            output.deleteCharAt(len-1);
		        } output.deleteCharAt(len-1) output.deleteCharAt output len-1 len 1 sc.close() sc.close sc System.out.println(output) System.out.println System.out System System.out output String[] args args
/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/
import java.util.Scanner;
 class Main
{
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String input = sc.nextLine();
		
		StringBuilder output = new StringBuilder();
		
		for (int i=0; i<input.length(); ++i) {
		    
		    if (input.charAt(i) != 'B') {
		        output.append(input.charAt(i));
		    }else {
		        int len = output.length();
		        if (len > 0) {
		            output.deleteCharAt(len-1);
		        }
		    }
		}
		
		sc.close();
		System.out.println(output);
	}
}
