import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			String s = sc.nextLine();
			StringBuilder sb = new StringBuilder(s);

			int index = sb.indexOf("B");
			while (true) {
				if (index == -1) {
					break;
				}

				sb = sb.deleteCharAt(index);
				if (index != 0) {
					sb = sb.deleteCharAt(index - 1);
				}

				index = sb.indexOf("B");
			}

			System.out.println(sb.toString());

		} finally {
			sc.close();
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			String s = sc.nextLine();
			StringBuilder sb = new StringBuilder(s);

			int index = sb.indexOf("B");
			while (true) {
				if (index == -1) {
					break;
				}

				sb = sb.deleteCharAt(index);
				if (index != 0) {
					sb = sb.deleteCharAt(index - 1);
				}

				index = sb.indexOf("B");
			}

			System.out.println(sb.toString());

		} finally {
			sc.close();
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			String s = sc.nextLine();
			StringBuilder sb = new StringBuilder(s);

			int index = sb.indexOf("B");
			while (true) {
				if (index == -1) {
					break;
				}

				sb = sb.deleteCharAt(index);
				if (index != 0) {
					sb = sb.deleteCharAt(index - 1);
				}

				index = sb.indexOf("B");
			}

			System.out.println(sb.toString());

		} finally {
			sc.close();
		}
	} main {
		Scanner sc = new Scanner(System.in);
		try {
			String s = sc.nextLine();
			StringBuilder sb = new StringBuilder(s);

			int index = sb.indexOf("B");
			while (true) {
				if (index == -1) {
					break;
				}

				sb = sb.deleteCharAt(index);
				if (index != 0) {
					sb = sb.deleteCharAt(index - 1);
				}

				index = sb.indexOf("B");
			}

			System.out.println(sb.toString());

		} finally {
			sc.close();
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) try {
			String s = sc.nextLine();
			StringBuilder sb = new StringBuilder(s);

			int index = sb.indexOf("B");
			while (true) {
				if (index == -1) {
					break;
				}

				sb = sb.deleteCharAt(index);
				if (index != 0) {
					sb = sb.deleteCharAt(index - 1);
				}

				index = sb.indexOf("B");
			}

			System.out.println(sb.toString());

		} finally {
			sc.close();
		} {
			sc.close();
		} sc.close() sc.close sc {
			String s = sc.nextLine();
			StringBuilder sb = new StringBuilder(s);

			int index = sb.indexOf("B");
			while (true) {
				if (index == -1) {
					break;
				}

				sb = sb.deleteCharAt(index);
				if (index != 0) {
					sb = sb.deleteCharAt(index - 1);
				}

				index = sb.indexOf("B");
			}

			System.out.println(sb.toString());

		} String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc StringBuilder sb = new StringBuilder(s); sb new StringBuilder(s) int index = sb.indexOf("B"); index sb.indexOf("B") sb.indexOf sb "B" while (true) {
				if (index == -1) {
					break;
				}

				sb = sb.deleteCharAt(index);
				if (index != 0) {
					sb = sb.deleteCharAt(index - 1);
				}

				index = sb.indexOf("B");
			} true {
				if (index == -1) {
					break;
				}

				sb = sb.deleteCharAt(index);
				if (index != 0) {
					sb = sb.deleteCharAt(index - 1);
				}

				index = sb.indexOf("B");
			} if (index == -1) {
					break;
				} index == -1 index -1 1 {
					break;
				} break; sb = sb.deleteCharAt(index) sb sb.deleteCharAt(index) sb.deleteCharAt sb index if (index != 0) {
					sb = sb.deleteCharAt(index - 1);
				} index != 0 index 0 {
					sb = sb.deleteCharAt(index - 1);
				} sb = sb.deleteCharAt(index - 1) sb sb.deleteCharAt(index - 1) sb.deleteCharAt sb index - 1 index 1 index = sb.indexOf("B") index sb.indexOf("B") sb.indexOf sb "B" 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);
		try {
			String s = sc.nextLine();
			StringBuilder sb = new StringBuilder(s);

			int index = sb.indexOf("B");
			while (true) {
				if (index == -1) {
					break;
				}

				sb = sb.deleteCharAt(index);
				if (index != 0) {
					sb = sb.deleteCharAt(index - 1);
				}

				index = sb.indexOf("B");
			}

			System.out.println(sb.toString());

		} finally {
			sc.close();
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			String s = sc.nextLine();
			StringBuilder sb = new StringBuilder(s);

			int index = sb.indexOf("B");
			while (true) {
				if (index == -1) {
					break;
				}

				sb = sb.deleteCharAt(index);
				if (index != 0) {
					sb = sb.deleteCharAt(index - 1);
				}

				index = sb.indexOf("B");
			}

			System.out.println(sb.toString());

		} finally {
			sc.close();
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			String s = sc.nextLine();
			StringBuilder sb = new StringBuilder(s);

			int index = sb.indexOf("B");
			while (true) {
				if (index == -1) {
					break;
				}

				sb = sb.deleteCharAt(index);
				if (index != 0) {
					sb = sb.deleteCharAt(index - 1);
				}

				index = sb.indexOf("B");
			}

			System.out.println(sb.toString());

		} finally {
			sc.close();
		}
	}
}