import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] inputs = scanner.nextLine().toCharArray();
		char[] outputs = new char[inputs.length];
		int oIndex = 0;
		for (int iIndex = 0; iIndex < inputs.length; iIndex++) {
			while (iIndex < inputs.length && inputs[iIndex] == 'B') {
				oIndex--;
				iIndex++;
			}
			if (iIndex >= inputs.length) break;
			if (oIndex < 0) oIndex = 0;
			outputs[oIndex++] = inputs[iIndex];
		}
		System.out.println(String.valueOf(Arrays.copyOf(outputs, oIndex)));
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] inputs = scanner.nextLine().toCharArray();
		char[] outputs = new char[inputs.length];
		int oIndex = 0;
		for (int iIndex = 0; iIndex < inputs.length; iIndex++) {
			while (iIndex < inputs.length && inputs[iIndex] == 'B') {
				oIndex--;
				iIndex++;
			}
			if (iIndex >= inputs.length) break;
			if (oIndex < 0) oIndex = 0;
			outputs[oIndex++] = inputs[iIndex];
		}
		System.out.println(String.valueOf(Arrays.copyOf(outputs, oIndex)));
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] inputs = scanner.nextLine().toCharArray();
		char[] outputs = new char[inputs.length];
		int oIndex = 0;
		for (int iIndex = 0; iIndex < inputs.length; iIndex++) {
			while (iIndex < inputs.length && inputs[iIndex] == 'B') {
				oIndex--;
				iIndex++;
			}
			if (iIndex >= inputs.length) break;
			if (oIndex < 0) oIndex = 0;
			outputs[oIndex++] = inputs[iIndex];
		}
		System.out.println(String.valueOf(Arrays.copyOf(outputs, oIndex)));
	} main {
		Scanner scanner = new Scanner(System.in);
		char[] inputs = scanner.nextLine().toCharArray();
		char[] outputs = new char[inputs.length];
		int oIndex = 0;
		for (int iIndex = 0; iIndex < inputs.length; iIndex++) {
			while (iIndex < inputs.length && inputs[iIndex] == 'B') {
				oIndex--;
				iIndex++;
			}
			if (iIndex >= inputs.length) break;
			if (oIndex < 0) oIndex = 0;
			outputs[oIndex++] = inputs[iIndex];
		}
		System.out.println(String.valueOf(Arrays.copyOf(outputs, oIndex)));
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) char[] inputs = scanner.nextLine().toCharArray(); inputs scanner.nextLine().toCharArray() scanner.nextLine().toCharArray scanner.nextLine() scanner.nextLine scanner char[] outputs = new char[inputs.length]; outputs new char[inputs.length] inputs.length inputs inputs.length int oIndex = 0; oIndex 0 for (int iIndex = 0; iIndex < inputs.length; iIndex++) {
			while (iIndex < inputs.length && inputs[iIndex] == 'B') {
				oIndex--;
				iIndex++;
			}
			if (iIndex >= inputs.length) break;
			if (oIndex < 0) oIndex = 0;
			outputs[oIndex++] = inputs[iIndex];
		} int iIndex = 0; int iIndex = 0; iIndex 0 iIndex < inputs.length iIndex inputs.length inputs inputs.length iIndex++ iIndex++ iIndex {
			while (iIndex < inputs.length && inputs[iIndex] == 'B') {
				oIndex--;
				iIndex++;
			}
			if (iIndex >= inputs.length) break;
			if (oIndex < 0) oIndex = 0;
			outputs[oIndex++] = inputs[iIndex];
		} {
			while (iIndex < inputs.length && inputs[iIndex] == 'B') {
				oIndex--;
				iIndex++;
			}
			if (iIndex >= inputs.length) break;
			if (oIndex < 0) oIndex = 0;
			outputs[oIndex++] = inputs[iIndex];
		} while (iIndex < inputs.length && inputs[iIndex] == 'B') {
				oIndex--;
				iIndex++;
			} iIndex < inputs.length && inputs[iIndex] == 'B' iIndex < inputs.length iIndex inputs.length inputs inputs.length inputs[iIndex] == 'B' inputs[iIndex] inputs iIndex 'B' {
				oIndex--;
				iIndex++;
			} oIndex-- oIndex iIndex++ iIndex if (iIndex >= inputs.length) break; iIndex >= inputs.length iIndex inputs.length inputs inputs.length break; if (oIndex < 0) oIndex = 0; oIndex < 0 oIndex 0 oIndex = 0 oIndex 0 outputs[oIndex++] = inputs[iIndex] outputs[oIndex++] outputs oIndex++ oIndex inputs[iIndex] inputs iIndex System.out.println(String.valueOf(Arrays.copyOf(outputs, oIndex))) System.out.println System.out System System.out String.valueOf(Arrays.copyOf(outputs, oIndex)) String.valueOf String Arrays.copyOf(outputs, oIndex) Arrays.copyOf Arrays outputs oIndex String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] inputs = scanner.nextLine().toCharArray();
		char[] outputs = new char[inputs.length];
		int oIndex = 0;
		for (int iIndex = 0; iIndex < inputs.length; iIndex++) {
			while (iIndex < inputs.length && inputs[iIndex] == 'B') {
				oIndex--;
				iIndex++;
			}
			if (iIndex >= inputs.length) break;
			if (oIndex < 0) oIndex = 0;
			outputs[oIndex++] = inputs[iIndex];
		}
		System.out.println(String.valueOf(Arrays.copyOf(outputs, oIndex)));
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] inputs = scanner.nextLine().toCharArray();
		char[] outputs = new char[inputs.length];
		int oIndex = 0;
		for (int iIndex = 0; iIndex < inputs.length; iIndex++) {
			while (iIndex < inputs.length && inputs[iIndex] == 'B') {
				oIndex--;
				iIndex++;
			}
			if (iIndex >= inputs.length) break;
			if (oIndex < 0) oIndex = 0;
			outputs[oIndex++] = inputs[iIndex];
		}
		System.out.println(String.valueOf(Arrays.copyOf(outputs, oIndex)));
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] inputs = scanner.nextLine().toCharArray();
		char[] outputs = new char[inputs.length];
		int oIndex = 0;
		for (int iIndex = 0; iIndex < inputs.length; iIndex++) {
			while (iIndex < inputs.length && inputs[iIndex] == 'B') {
				oIndex--;
				iIndex++;
			}
			if (iIndex >= inputs.length) break;
			if (oIndex < 0) oIndex = 0;
			outputs[oIndex++] = inputs[iIndex];
		}
		System.out.println(String.valueOf(Arrays.copyOf(outputs, oIndex)));
	}
}
