import java.util.Scanner;

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

		StringBuilder sb = new StringBuilder();

		String s = sc.nextLine();

		for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
			case '0':
				sb.append("0");
				break;
			case '1':
				sb.append("1");
				break;
			case 'B':
				if (!sb.toString().equals("")) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			}
		}
		System.out.println(sb);
		sc.close();
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		StringBuilder sb = new StringBuilder();

		String s = sc.nextLine();

		for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
			case '0':
				sb.append("0");
				break;
			case '1':
				sb.append("1");
				break;
			case 'B':
				if (!sb.toString().equals("")) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			}
		}
		System.out.println(sb);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		StringBuilder sb = new StringBuilder();

		String s = sc.nextLine();

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

		StringBuilder sb = new StringBuilder();

		String s = sc.nextLine();

		for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
			case '0':
				sb.append("0");
				break;
			case '1':
				sb.append("1");
				break;
			case 'B':
				if (!sb.toString().equals("")) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			}
		}
		System.out.println(sb);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder sb = new StringBuilder(); sb new StringBuilder() String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
			case '0':
				sb.append("0");
				break;
			case '1':
				sb.append("1");
				break;
			case 'B':
				if (!sb.toString().equals("")) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			switch (s.charAt(i)) {
			case '0':
				sb.append("0");
				break;
			case '1':
				sb.append("1");
				break;
			case 'B':
				if (!sb.toString().equals("")) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			}
		} {
			switch (s.charAt(i)) {
			case '0':
				sb.append("0");
				break;
			case '1':
				sb.append("1");
				break;
			case 'B':
				if (!sb.toString().equals("")) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			}
		} switch (s.charAt(i)) {
			case '0':
				sb.append("0");
				break;
			case '1':
				sb.append("1");
				break;
			case 'B':
				if (!sb.toString().equals("")) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			} s.charAt(i) s.charAt s i 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.toString().equals("")) {
					sb.deleteCharAt(sb.length() - 1);
				} !sb.toString().equals("") sb.toString().equals("") sb.toString().equals sb.toString() sb.toString sb "" {
					sb.deleteCharAt(sb.length() - 1);
				} sb.deleteCharAt(sb.length() - 1) sb.deleteCharAt sb sb.length() - 1 sb.length() sb.length sb 1 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 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		StringBuilder sb = new StringBuilder();

		String s = sc.nextLine();

		for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
			case '0':
				sb.append("0");
				break;
			case '1':
				sb.append("1");
				break;
			case 'B':
				if (!sb.toString().equals("")) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			}
		}
		System.out.println(sb);
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		StringBuilder sb = new StringBuilder();

		String s = sc.nextLine();

		for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
			case '0':
				sb.append("0");
				break;
			case '1':
				sb.append("1");
				break;
			case 'B':
				if (!sb.toString().equals("")) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			}
		}
		System.out.println(sb);
		sc.close();
	}
} Main
import java.util.Scanner;

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

		StringBuilder sb = new StringBuilder();

		String s = sc.nextLine();

		for (int i = 0; i < s.length(); i++) {
			switch (s.charAt(i)) {
			case '0':
				sb.append("0");
				break;
			case '1':
				sb.append("1");
				break;
			case 'B':
				if (!sb.toString().equals("")) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			}
		}
		System.out.println(sb);
		sc.close();
	}
}

