import java.util.Scanner;

public class Main {
	static boolean[][] nodes;
	static int cnt = 0;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			switch (c) {
			case '0':
				sb.append('0');
				break;
			case '1':
				sb.append('1');
				break;
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				break;
			}
		}
		System.out.println(sb);
		sc.close();
	}

} import java.util.Scanner; Scanner java.util public class Main {
	static boolean[][] nodes;
	static int cnt = 0;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			switch (c) {
			case '0':
				sb.append('0');
				break;
			case '1':
				sb.append('1');
				break;
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				break;
			}
		}
		System.out.println(sb);
		sc.close();
	}

} Main static boolean[][] nodes; nodes static int cnt = 0; cnt 0 public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			switch (c) {
			case '0':
				sb.append('0');
				break;
			case '1':
				sb.append('1');
				break;
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				break;
			}
		}
		System.out.println(sb);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			switch (c) {
			case '0':
				sb.append('0');
				break;
			case '1':
				sb.append('1');
				break;
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				break;
			}
		}
		System.out.println(sb);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			switch (c) {
			case '0':
				sb.append('0');
				break;
			case '1':
				sb.append('1');
				break;
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				break;
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			char c = s.charAt(i);
			switch (c) {
			case '0':
				sb.append('0');
				break;
			case '1':
				sb.append('1');
				break;
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				break;
			}
		} {
			char c = s.charAt(i);
			switch (c) {
			case '0':
				sb.append('0');
				break;
			case '1':
				sb.append('1');
				break;
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				break;
			}
		} char c = s.charAt(i); c s.charAt(i) s.charAt s i switch (c) {
			case '0':
				sb.append('0');
				break;
			case '1':
				sb.append('1');
				break;
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				break;
			} c case '0': '0' case '0': sb.append('0') sb.append sb '0' break; case '1': '1' case '1': sb.append('1') sb.append sb '1' break; case 'B': 'B' case 'B': 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 break; default: default: break; System.out.println(sb) System.out.println System.out System System.out sb sc.close() sc.close sc String[] args args public class Main {
	static boolean[][] nodes;
	static int cnt = 0;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			switch (c) {
			case '0':
				sb.append('0');
				break;
			case '1':
				sb.append('1');
				break;
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				break;
			}
		}
		System.out.println(sb);
		sc.close();
	}

} public class Main {
	static boolean[][] nodes;
	static int cnt = 0;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			switch (c) {
			case '0':
				sb.append('0');
				break;
			case '1':
				sb.append('1');
				break;
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				break;
			}
		}
		System.out.println(sb);
		sc.close();
	}

} Main
import java.util.Scanner;

public class Main {
	static boolean[][] nodes;
	static int cnt = 0;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			switch (c) {
			case '0':
				sb.append('0');
				break;
			case '1':
				sb.append('1');
				break;
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				break;
			}
		}
		System.out.println(sb);
		sc.close();
	}

}
