import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		List answer = new ArrayList<String>();

		for (char s : S.toCharArray()) {
			if (s == '0') answer.add("0");
			if (s == '1') answer.add("1");
			if (s == 'B' && answer.size() != 0) answer.remove(answer.size() - 1);
		}

		System.out.println(String.join("", answer));
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		List answer = new ArrayList<String>();

		for (char s : S.toCharArray()) {
			if (s == '0') answer.add("0");
			if (s == '1') answer.add("1");
			if (s == 'B' && answer.size() != 0) answer.remove(answer.size() - 1);
		}

		System.out.println(String.join("", answer));
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		List answer = new ArrayList<String>();

		for (char s : S.toCharArray()) {
			if (s == '0') answer.add("0");
			if (s == '1') answer.add("1");
			if (s == 'B' && answer.size() != 0) answer.remove(answer.size() - 1);
		}

		System.out.println(String.join("", answer));
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		List answer = new ArrayList<String>();

		for (char s : S.toCharArray()) {
			if (s == '0') answer.add("0");
			if (s == '1') answer.add("1");
			if (s == 'B' && answer.size() != 0) answer.remove(answer.size() - 1);
		}

		System.out.println(String.join("", answer));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc List answer = new ArrayList<String>(); answer new ArrayList<String>() for (char s : S.toCharArray()) {
			if (s == '0') answer.add("0");
			if (s == '1') answer.add("1");
			if (s == 'B' && answer.size() != 0) answer.remove(answer.size() - 1);
		} char s S.toCharArray() S.toCharArray S {
			if (s == '0') answer.add("0");
			if (s == '1') answer.add("1");
			if (s == 'B' && answer.size() != 0) answer.remove(answer.size() - 1);
		} {
			if (s == '0') answer.add("0");
			if (s == '1') answer.add("1");
			if (s == 'B' && answer.size() != 0) answer.remove(answer.size() - 1);
		} if (s == '0') answer.add("0"); s == '0' s '0' answer.add("0") answer.add answer "0" if (s == '1') answer.add("1"); s == '1' s '1' answer.add("1") answer.add answer "1" if (s == 'B' && answer.size() != 0) answer.remove(answer.size() - 1); s == 'B' && answer.size() != 0 s == 'B' s 'B' answer.size() != 0 answer.size() answer.size answer 0 answer.remove(answer.size() - 1) answer.remove answer answer.size() - 1 answer.size() answer.size answer 1 System.out.println(String.join("", answer)) System.out.println System.out System System.out String.join("", answer) String.join String "" answer String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		List answer = new ArrayList<String>();

		for (char s : S.toCharArray()) {
			if (s == '0') answer.add("0");
			if (s == '1') answer.add("1");
			if (s == 'B' && answer.size() != 0) answer.remove(answer.size() - 1);
		}

		System.out.println(String.join("", answer));
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		List answer = new ArrayList<String>();

		for (char s : S.toCharArray()) {
			if (s == '0') answer.add("0");
			if (s == '1') answer.add("1");
			if (s == 'B' && answer.size() != 0) answer.remove(answer.size() - 1);
		}

		System.out.println(String.join("", answer));
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		List answer = new ArrayList<String>();

		for (char s : S.toCharArray()) {
			if (s == '0') answer.add("0");
			if (s == '1') answer.add("1");
			if (s == 'B' && answer.size() != 0) answer.remove(answer.size() - 1);
		}

		System.out.println(String.join("", answer));
	}
}
