import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// get a integer
		String N = sc.next();
		String output = "";
		
		for (int i = 0; i < N.length(); i++) {
			int output_size = output.length();
			if(N.charAt(i) == 'B') {
				if(output_size > 0) {
					output = output.substring(0, output_size - 1);
				}
			} else {
				output = output + N.substring(i, i+1); 
			}
			
		}
				
		// output
		System.out.println(output);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// get a integer
		String N = sc.next();
		String output = "";
		
		for (int i = 0; i < N.length(); i++) {
			int output_size = output.length();
			if(N.charAt(i) == 'B') {
				if(output_size > 0) {
					output = output.substring(0, output_size - 1);
				}
			} else {
				output = output + N.substring(i, i+1); 
			}
			
		}
				
		// output
		System.out.println(output);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// get a integer
		String N = sc.next();
		String output = "";
		
		for (int i = 0; i < N.length(); i++) {
			int output_size = output.length();
			if(N.charAt(i) == 'B') {
				if(output_size > 0) {
					output = output.substring(0, output_size - 1);
				}
			} else {
				output = output + N.substring(i, i+1); 
			}
			
		}
				
		// output
		System.out.println(output);
	} main {
		Scanner sc = new Scanner(System.in);
		// get a integer
		String N = sc.next();
		String output = "";
		
		for (int i = 0; i < N.length(); i++) {
			int output_size = output.length();
			if(N.charAt(i) == 'B') {
				if(output_size > 0) {
					output = output.substring(0, output_size - 1);
				}
			} else {
				output = output + N.substring(i, i+1); 
			}
			
		}
				
		// output
		System.out.println(output);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String N = sc.next(); N sc.next() sc.next sc String output = ""; output "" for (int i = 0; i < N.length(); i++) {
			int output_size = output.length();
			if(N.charAt(i) == 'B') {
				if(output_size > 0) {
					output = output.substring(0, output_size - 1);
				}
			} else {
				output = output + N.substring(i, i+1); 
			}
			
		} int i = 0; int i = 0; i 0 i < N.length() i N.length() N.length N i++ i++ i {
			int output_size = output.length();
			if(N.charAt(i) == 'B') {
				if(output_size > 0) {
					output = output.substring(0, output_size - 1);
				}
			} else {
				output = output + N.substring(i, i+1); 
			}
			
		} {
			int output_size = output.length();
			if(N.charAt(i) == 'B') {
				if(output_size > 0) {
					output = output.substring(0, output_size - 1);
				}
			} else {
				output = output + N.substring(i, i+1); 
			}
			
		} int output_size = output.length(); output_size output.length() output.length output if(N.charAt(i) == 'B') {
				if(output_size > 0) {
					output = output.substring(0, output_size - 1);
				}
			} else {
				output = output + N.substring(i, i+1); 
			} N.charAt(i) == 'B' N.charAt(i) N.charAt N i 'B' {
				if(output_size > 0) {
					output = output.substring(0, output_size - 1);
				}
			} if(output_size > 0) {
					output = output.substring(0, output_size - 1);
				} output_size > 0 output_size 0 {
					output = output.substring(0, output_size - 1);
				} output = output.substring(0, output_size - 1) output output.substring(0, output_size - 1) output.substring output 0 output_size - 1 output_size 1 {
				output = output + N.substring(i, i+1); 
			} output = output + N.substring(i, i+1) output output + N.substring(i, i+1) output N.substring(i, i+1) N.substring N i i+1 i 1 System.out.println(output) System.out.println System.out System System.out output String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// get a integer
		String N = sc.next();
		String output = "";
		
		for (int i = 0; i < N.length(); i++) {
			int output_size = output.length();
			if(N.charAt(i) == 'B') {
				if(output_size > 0) {
					output = output.substring(0, output_size - 1);
				}
			} else {
				output = output + N.substring(i, i+1); 
			}
			
		}
				
		// output
		System.out.println(output);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// get a integer
		String N = sc.next();
		String output = "";
		
		for (int i = 0; i < N.length(); i++) {
			int output_size = output.length();
			if(N.charAt(i) == 'B') {
				if(output_size > 0) {
					output = output.substring(0, output_size - 1);
				}
			} else {
				output = output + N.substring(i, i+1); 
			}
			
		}
				
		// output
		System.out.println(output);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// get a integer
		String N = sc.next();
		String output = "";
		
		for (int i = 0; i < N.length(); i++) {
			int output_size = output.length();
			if(N.charAt(i) == 'B') {
				if(output_size > 0) {
					output = output.substring(0, output_size - 1);
				}
			} else {
				output = output + N.substring(i, i+1); 
			}
			
		}
				
		// output
		System.out.println(output);
	}
}