import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		
		char[] c = s.toCharArray();
		
		StringBuilder sb = new StringBuilder();
		for (int i=0; i<c.length; i++) {
			if (c[i] == '0' | c[i] == '1') {
				sb.append(c[i]);
			} else if (c[i] == 'B') {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			}
		}
		
		System.out.println(sb.toString());
	}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		
		char[] c = s.toCharArray();
		
		StringBuilder sb = new StringBuilder();
		for (int i=0; i<c.length; i++) {
			if (c[i] == '0' | c[i] == '1') {
				sb.append(c[i]);
			} else if (c[i] == 'B') {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			}
		}
		
		System.out.println(sb.toString());
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		
		char[] c = s.toCharArray();
		
		StringBuilder sb = new StringBuilder();
		for (int i=0; i<c.length; i++) {
			if (c[i] == '0' | c[i] == '1') {
				sb.append(c[i]);
			} else if (c[i] == 'B') {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			}
		}
		
		System.out.println(sb.toString());
	} main {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		
		char[] c = s.toCharArray();
		
		StringBuilder sb = new StringBuilder();
		for (int i=0; i<c.length; i++) {
			if (c[i] == '0' | c[i] == '1') {
				sb.append(c[i]);
			} else if (c[i] == 'B') {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			}
		}
		
		System.out.println(sb.toString());
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc char[] c = s.toCharArray(); c s.toCharArray() s.toCharArray s StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i=0; i<c.length; i++) {
			if (c[i] == '0' | c[i] == '1') {
				sb.append(c[i]);
			} else if (c[i] == 'B') {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			}
		} int i=0; int i=0; i 0 i<c.length i c.length c c.length i++ i++ i {
			if (c[i] == '0' | c[i] == '1') {
				sb.append(c[i]);
			} else if (c[i] == 'B') {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			}
		} {
			if (c[i] == '0' | c[i] == '1') {
				sb.append(c[i]);
			} else if (c[i] == 'B') {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			}
		} if (c[i] == '0' | c[i] == '1') {
				sb.append(c[i]);
			} else if (c[i] == 'B') {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			} c[i] == '0' | c[i] == '1' c[i] == '0' c[i] c i '0' c[i] == '1' c[i] c i '1' {
				sb.append(c[i]);
			} sb.append(c[i]) sb.append sb c[i] c i if (c[i] == 'B') {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			} c[i] == 'B' c[i] c i 'B' {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			} if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				} sb.length() > 0 sb.length() sb.length sb 0 {
					sb.deleteCharAt(sb.length()-1);
				} sb.deleteCharAt(sb.length()-1) sb.deleteCharAt sb sb.length()-1 sb.length() sb.length sb 1 System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		
		char[] c = s.toCharArray();
		
		StringBuilder sb = new StringBuilder();
		for (int i=0; i<c.length; i++) {
			if (c[i] == '0' | c[i] == '1') {
				sb.append(c[i]);
			} else if (c[i] == 'B') {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			}
		}
		
		System.out.println(sb.toString());
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		
		char[] c = s.toCharArray();
		
		StringBuilder sb = new StringBuilder();
		for (int i=0; i<c.length; i++) {
			if (c[i] == '0' | c[i] == '1') {
				sb.append(c[i]);
			} else if (c[i] == 'B') {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			}
		}
		
		System.out.println(sb.toString());
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		
		char[] c = s.toCharArray();
		
		StringBuilder sb = new StringBuilder();
		for (int i=0; i<c.length; i++) {
			if (c[i] == '0' | c[i] == '1') {
				sb.append(c[i]);
			} else if (c[i] == 'B') {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			}
		}
		
		System.out.println(sb.toString());
	}

}
