import java.util.Scanner;

class Main {
	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String answer="";

		for(int i=0; i<s.length();i++) {
			char target = s.charAt(i);
			if(target=='0') {
				answer+='0';
			}
			if(target=='1') {
				answer+='1';
			}
			if(target=='B') {
				if(answer != null && answer.length() > 0){
					answer = answer.substring(0, answer.length()-1);
				}
			}
		}
		
		System.out.println(answer);

	}
} import java.util.Scanner; Scanner java.util class Main {
	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String answer="";

		for(int i=0; i<s.length();i++) {
			char target = s.charAt(i);
			if(target=='0') {
				answer+='0';
			}
			if(target=='1') {
				answer+='1';
			}
			if(target=='B') {
				if(answer != null && answer.length() > 0){
					answer = answer.substring(0, answer.length()-1);
				}
			}
		}
		
		System.out.println(answer);

	}
} Main @SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String answer="";

		for(int i=0; i<s.length();i++) {
			char target = s.charAt(i);
			if(target=='0') {
				answer+='0';
			}
			if(target=='1') {
				answer+='1';
			}
			if(target=='B') {
				if(answer != null && answer.length() > 0){
					answer = answer.substring(0, answer.length()-1);
				}
			}
		}
		
		System.out.println(answer);

	} main {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String answer="";

		for(int i=0; i<s.length();i++) {
			char target = s.charAt(i);
			if(target=='0') {
				answer+='0';
			}
			if(target=='1') {
				answer+='1';
			}
			if(target=='B') {
				if(answer != null && answer.length() > 0){
					answer = answer.substring(0, answer.length()-1);
				}
			}
		}
		
		System.out.println(answer);

	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner String answer=""; answer "" for(int i=0; i<s.length();i++) {
			char target = s.charAt(i);
			if(target=='0') {
				answer+='0';
			}
			if(target=='1') {
				answer+='1';
			}
			if(target=='B') {
				if(answer != null && answer.length() > 0){
					answer = answer.substring(0, answer.length()-1);
				}
			}
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			char target = s.charAt(i);
			if(target=='0') {
				answer+='0';
			}
			if(target=='1') {
				answer+='1';
			}
			if(target=='B') {
				if(answer != null && answer.length() > 0){
					answer = answer.substring(0, answer.length()-1);
				}
			}
		} {
			char target = s.charAt(i);
			if(target=='0') {
				answer+='0';
			}
			if(target=='1') {
				answer+='1';
			}
			if(target=='B') {
				if(answer != null && answer.length() > 0){
					answer = answer.substring(0, answer.length()-1);
				}
			}
		} char target = s.charAt(i); target s.charAt(i) s.charAt s i if(target=='0') {
				answer+='0';
			} target=='0' target '0' {
				answer+='0';
			} answer+='0' answer '0' if(target=='1') {
				answer+='1';
			} target=='1' target '1' {
				answer+='1';
			} answer+='1' answer '1' if(target=='B') {
				if(answer != null && answer.length() > 0){
					answer = answer.substring(0, answer.length()-1);
				}
			} target=='B' target 'B' {
				if(answer != null && answer.length() > 0){
					answer = answer.substring(0, answer.length()-1);
				}
			} if(answer != null && answer.length() > 0){
					answer = answer.substring(0, answer.length()-1);
				} answer != null && answer.length() > 0 answer != null answer null answer.length() > 0 answer.length() answer.length answer 0 {
					answer = answer.substring(0, answer.length()-1);
				} answer = answer.substring(0, answer.length()-1) answer answer.substring(0, answer.length()-1) answer.substring answer 0 answer.length()-1 answer.length() answer.length answer 1 System.out.println(answer) System.out.println System.out System System.out answer String args[] args
import java.util.Scanner;

class Main {
	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String answer="";

		for(int i=0; i<s.length();i++) {
			char target = s.charAt(i);
			if(target=='0') {
				answer+='0';
			}
			if(target=='1') {
				answer+='1';
			}
			if(target=='B') {
				if(answer != null && answer.length() > 0){
					answer = answer.substring(0, answer.length()-1);
				}
			}
		}
		
		System.out.println(answer);

	}
}