import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		String s = scan.next();
		StringBuilder sb = new StringBuilder();
		for (char si : s.toCharArray()) {
			switch (si) {
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				sb.append(si);
				break;
			}
		}
		System.out.println(sb.toString());
	}

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

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		String s = scan.next();
		StringBuilder sb = new StringBuilder();
		for (char si : s.toCharArray()) {
			switch (si) {
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				sb.append(si);
				break;
			}
		}
		System.out.println(sb.toString());
	}

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

		String s = scan.next();
		StringBuilder sb = new StringBuilder();
		for (char si : s.toCharArray()) {
			switch (si) {
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				sb.append(si);
				break;
			}
		}
		System.out.println(sb.toString());
	} main {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		String s = scan.next();
		StringBuilder sb = new StringBuilder();
		for (char si : s.toCharArray()) {
			switch (si) {
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				sb.append(si);
				break;
			}
		}
		System.out.println(sb.toString());
	} @SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (char si : s.toCharArray()) {
			switch (si) {
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				sb.append(si);
				break;
			}
		} char si s.toCharArray() s.toCharArray s {
			switch (si) {
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				sb.append(si);
				break;
			}
		} {
			switch (si) {
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				sb.append(si);
				break;
			}
		} switch (si) {
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				sb.append(si);
				break;
			} si 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: sb.append(si) sb.append sb si break; 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) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		String s = scan.next();
		StringBuilder sb = new StringBuilder();
		for (char si : s.toCharArray()) {
			switch (si) {
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				sb.append(si);
				break;
			}
		}
		System.out.println(sb.toString());
	}

} public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		String s = scan.next();
		StringBuilder sb = new StringBuilder();
		for (char si : s.toCharArray()) {
			switch (si) {
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				sb.append(si);
				break;
			}
		}
		System.out.println(sb.toString());
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		String s = scan.next();
		StringBuilder sb = new StringBuilder();
		for (char si : s.toCharArray()) {
			switch (si) {
			case 'B':
				if (sb.length() != 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
				break;
			default:
				sb.append(si);
				break;
			}
		}
		System.out.println(sb.toString());
	}

}