import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			char[] array = new char[10];
			int pos = 0;
			String str = s.next();
			int n = str.length();
			for (int i = 0; i < n; i++) {
				char c = str.charAt(i);
				switch (c) {
				case 'B':
					if (pos > 0) {
						pos--;
					}
					break;
				default:
					array[pos++] = c;
					break;
				}
			}
			for (int i = 0; i < pos; i++) {
				System.out.print(array[i]);
			}
			System.out.println();
		}

	}

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

	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			char[] array = new char[10];
			int pos = 0;
			String str = s.next();
			int n = str.length();
			for (int i = 0; i < n; i++) {
				char c = str.charAt(i);
				switch (c) {
				case 'B':
					if (pos > 0) {
						pos--;
					}
					break;
				default:
					array[pos++] = c;
					break;
				}
			}
			for (int i = 0; i < pos; i++) {
				System.out.print(array[i]);
			}
			System.out.println();
		}

	}

} Main public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			char[] array = new char[10];
			int pos = 0;
			String str = s.next();
			int n = str.length();
			for (int i = 0; i < n; i++) {
				char c = str.charAt(i);
				switch (c) {
				case 'B':
					if (pos > 0) {
						pos--;
					}
					break;
				default:
					array[pos++] = c;
					break;
				}
			}
			for (int i = 0; i < pos; i++) {
				System.out.print(array[i]);
			}
			System.out.println();
		}

	} main {
		try (Scanner s = new Scanner(System.in)) {
			char[] array = new char[10];
			int pos = 0;
			String str = s.next();
			int n = str.length();
			for (int i = 0; i < n; i++) {
				char c = str.charAt(i);
				switch (c) {
				case 'B':
					if (pos > 0) {
						pos--;
					}
					break;
				default:
					array[pos++] = c;
					break;
				}
			}
			for (int i = 0; i < pos; i++) {
				System.out.print(array[i]);
			}
			System.out.println();
		}

	} try (Scanner s = new Scanner(System.in)) {
			char[] array = new char[10];
			int pos = 0;
			String str = s.next();
			int n = str.length();
			for (int i = 0; i < n; i++) {
				char c = str.charAt(i);
				switch (c) {
				case 'B':
					if (pos > 0) {
						pos--;
					}
					break;
				default:
					array[pos++] = c;
					break;
				}
			}
			for (int i = 0; i < pos; i++) {
				System.out.print(array[i]);
			}
			System.out.println();
		} {
			char[] array = new char[10];
			int pos = 0;
			String str = s.next();
			int n = str.length();
			for (int i = 0; i < n; i++) {
				char c = str.charAt(i);
				switch (c) {
				case 'B':
					if (pos > 0) {
						pos--;
					}
					break;
				default:
					array[pos++] = c;
					break;
				}
			}
			for (int i = 0; i < pos; i++) {
				System.out.print(array[i]);
			}
			System.out.println();
		} Scanner s = new Scanner(System.in) Scanner s = new Scanner(System.in) new Scanner(System.in) char[] array = new char[10]; array new char[10] 10 int pos = 0; pos 0 String str = s.next(); str s.next() s.next s int n = str.length(); n str.length() str.length str for (int i = 0; i < n; i++) {
				char c = str.charAt(i);
				switch (c) {
				case 'B':
					if (pos > 0) {
						pos--;
					}
					break;
				default:
					array[pos++] = c;
					break;
				}
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				char c = str.charAt(i);
				switch (c) {
				case 'B':
					if (pos > 0) {
						pos--;
					}
					break;
				default:
					array[pos++] = c;
					break;
				}
			} {
				char c = str.charAt(i);
				switch (c) {
				case 'B':
					if (pos > 0) {
						pos--;
					}
					break;
				default:
					array[pos++] = c;
					break;
				}
			} char c = str.charAt(i); c str.charAt(i) str.charAt str i switch (c) {
				case 'B':
					if (pos > 0) {
						pos--;
					}
					break;
				default:
					array[pos++] = c;
					break;
				} c case 'B': 'B' case 'B': if (pos > 0) {
						pos--;
					} pos > 0 pos 0 {
						pos--;
					} pos-- pos break; default: default: array[pos++] = c array[pos++] array pos++ pos c break; for (int i = 0; i < pos; i++) {
				System.out.print(array[i]);
			} int i = 0; int i = 0; i 0 i < pos i pos i++ i++ i {
				System.out.print(array[i]);
			} {
				System.out.print(array[i]);
			} System.out.print(array[i]) System.out.print System.out System System.out array[i] array i System.out.println() System.out.println System.out System System.out String[] args args public class Main {

	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			char[] array = new char[10];
			int pos = 0;
			String str = s.next();
			int n = str.length();
			for (int i = 0; i < n; i++) {
				char c = str.charAt(i);
				switch (c) {
				case 'B':
					if (pos > 0) {
						pos--;
					}
					break;
				default:
					array[pos++] = c;
					break;
				}
			}
			for (int i = 0; i < pos; i++) {
				System.out.print(array[i]);
			}
			System.out.println();
		}

	}

} public class Main {

	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			char[] array = new char[10];
			int pos = 0;
			String str = s.next();
			int n = str.length();
			for (int i = 0; i < n; i++) {
				char c = str.charAt(i);
				switch (c) {
				case 'B':
					if (pos > 0) {
						pos--;
					}
					break;
				default:
					array[pos++] = c;
					break;
				}
			}
			for (int i = 0; i < pos; i++) {
				System.out.print(array[i]);
			}
			System.out.println();
		}

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			char[] array = new char[10];
			int pos = 0;
			String str = s.next();
			int n = str.length();
			for (int i = 0; i < n; i++) {
				char c = str.charAt(i);
				switch (c) {
				case 'B':
					if (pos > 0) {
						pos--;
					}
					break;
				default:
					array[pos++] = c;
					break;
				}
			}
			for (int i = 0; i < pos; i++) {
				System.out.print(array[i]);
			}
			System.out.println();
		}

	}

}
