import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			if(s.substring(i, i+1).equals("0")) {
				ans.append("0");
			}
			else if(s.substring(i, i+1).equals("1")) {
				ans.append("1");
			}
			else if(s.substring(i, i+1).equals("B")) {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			}
		}
		System.out.println(ans);
	    scanner.close();
		}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			if(s.substring(i, i+1).equals("0")) {
				ans.append("0");
			}
			else if(s.substring(i, i+1).equals("1")) {
				ans.append("1");
			}
			else if(s.substring(i, i+1).equals("B")) {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			}
		}
		System.out.println(ans);
	    scanner.close();
		}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			if(s.substring(i, i+1).equals("0")) {
				ans.append("0");
			}
			else if(s.substring(i, i+1).equals("1")) {
				ans.append("1");
			}
			else if(s.substring(i, i+1).equals("B")) {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			}
		}
		System.out.println(ans);
	    scanner.close();
		} main {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			if(s.substring(i, i+1).equals("0")) {
				ans.append("0");
			}
			else if(s.substring(i, i+1).equals("1")) {
				ans.append("1");
			}
			else if(s.substring(i, i+1).equals("B")) {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			}
		}
		System.out.println(ans);
	    scanner.close();
		} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner StringBuilder ans = new StringBuilder(); ans new StringBuilder() for (int i = 0; i < s.length(); i++) {
			if(s.substring(i, i+1).equals("0")) {
				ans.append("0");
			}
			else if(s.substring(i, i+1).equals("1")) {
				ans.append("1");
			}
			else if(s.substring(i, i+1).equals("B")) {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			if(s.substring(i, i+1).equals("0")) {
				ans.append("0");
			}
			else if(s.substring(i, i+1).equals("1")) {
				ans.append("1");
			}
			else if(s.substring(i, i+1).equals("B")) {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			}
		} {
			if(s.substring(i, i+1).equals("0")) {
				ans.append("0");
			}
			else if(s.substring(i, i+1).equals("1")) {
				ans.append("1");
			}
			else if(s.substring(i, i+1).equals("B")) {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			}
		} if(s.substring(i, i+1).equals("0")) {
				ans.append("0");
			}
			else if(s.substring(i, i+1).equals("1")) {
				ans.append("1");
			}
			else if(s.substring(i, i+1).equals("B")) {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			} s.substring(i, i+1).equals("0") s.substring(i, i+1).equals s.substring(i, i+1) s.substring s i i+1 i 1 "0" {
				ans.append("0");
			} ans.append("0") ans.append ans "0" if(s.substring(i, i+1).equals("1")) {
				ans.append("1");
			}
			else if(s.substring(i, i+1).equals("B")) {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			} s.substring(i, i+1).equals("1") s.substring(i, i+1).equals s.substring(i, i+1) s.substring s i i+1 i 1 "1" {
				ans.append("1");
			} ans.append("1") ans.append ans "1" if(s.substring(i, i+1).equals("B")) {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			} s.substring(i, i+1).equals("B") s.substring(i, i+1).equals s.substring(i, i+1) s.substring s i i+1 i 1 "B" {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			} if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				} ans.length()>0 ans.length() ans.length ans 0 {
					ans.delete(ans.length()-1,ans.length());
				} ans.delete(ans.length()-1,ans.length()) ans.delete ans ans.length()-1 ans.length() ans.length ans 1 ans.length() ans.length ans System.out.println(ans) System.out.println System.out System System.out ans scanner.close() scanner.close scanner String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			if(s.substring(i, i+1).equals("0")) {
				ans.append("0");
			}
			else if(s.substring(i, i+1).equals("1")) {
				ans.append("1");
			}
			else if(s.substring(i, i+1).equals("B")) {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			}
		}
		System.out.println(ans);
	    scanner.close();
		}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			if(s.substring(i, i+1).equals("0")) {
				ans.append("0");
			}
			else if(s.substring(i, i+1).equals("1")) {
				ans.append("1");
			}
			else if(s.substring(i, i+1).equals("B")) {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			}
		}
		System.out.println(ans);
	    scanner.close();
		}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			if(s.substring(i, i+1).equals("0")) {
				ans.append("0");
			}
			else if(s.substring(i, i+1).equals("1")) {
				ans.append("1");
			}
			else if(s.substring(i, i+1).equals("B")) {
				if(ans.length()>0) {
					ans.delete(ans.length()-1,ans.length());
				}
			}
		}
		System.out.println(ans);
	    scanner.close();
		}
}
