

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();

		StringBuilder ans = new StringBuilder();

		for (char ch : c) {
			if (ch == '0')
				ans.append("0");

			if (ch == '1')
				ans.append("1");

			if (ch == 'B') {
				if (ans.length() == 1)
					ans = new StringBuilder();
				if (!ans.toString().isEmpty())
					ans.setLength(ans.length() - 1);
			}
		}

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

	}

} 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();
		char[] c = s.toCharArray();

		StringBuilder ans = new StringBuilder();

		for (char ch : c) {
			if (ch == '0')
				ans.append("0");

			if (ch == '1')
				ans.append("1");

			if (ch == 'B') {
				if (ans.length() == 1)
					ans = new StringBuilder();
				if (!ans.toString().isEmpty())
					ans.setLength(ans.length() - 1);
			}
		}

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

	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();

		StringBuilder ans = new StringBuilder();

		for (char ch : c) {
			if (ch == '0')
				ans.append("0");

			if (ch == '1')
				ans.append("1");

			if (ch == 'B') {
				if (ans.length() == 1)
					ans = new StringBuilder();
				if (!ans.toString().isEmpty())
					ans.setLength(ans.length() - 1);
			}
		}

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

	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();

		StringBuilder ans = new StringBuilder();

		for (char ch : c) {
			if (ch == '0')
				ans.append("0");

			if (ch == '1')
				ans.append("1");

			if (ch == 'B') {
				if (ans.length() == 1)
					ans = new StringBuilder();
				if (!ans.toString().isEmpty())
					ans.setLength(ans.length() - 1);
			}
		}

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

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc char[] c = s.toCharArray(); c s.toCharArray() s.toCharArray s StringBuilder ans = new StringBuilder(); ans new StringBuilder() for (char ch : c) {
			if (ch == '0')
				ans.append("0");

			if (ch == '1')
				ans.append("1");

			if (ch == 'B') {
				if (ans.length() == 1)
					ans = new StringBuilder();
				if (!ans.toString().isEmpty())
					ans.setLength(ans.length() - 1);
			}
		} char ch c {
			if (ch == '0')
				ans.append("0");

			if (ch == '1')
				ans.append("1");

			if (ch == 'B') {
				if (ans.length() == 1)
					ans = new StringBuilder();
				if (!ans.toString().isEmpty())
					ans.setLength(ans.length() - 1);
			}
		} {
			if (ch == '0')
				ans.append("0");

			if (ch == '1')
				ans.append("1");

			if (ch == 'B') {
				if (ans.length() == 1)
					ans = new StringBuilder();
				if (!ans.toString().isEmpty())
					ans.setLength(ans.length() - 1);
			}
		} if (ch == '0')
				ans.append("0"); ch == '0' ch '0' ans.append("0") ans.append ans "0" if (ch == '1')
				ans.append("1"); ch == '1' ch '1' ans.append("1") ans.append ans "1" if (ch == 'B') {
				if (ans.length() == 1)
					ans = new StringBuilder();
				if (!ans.toString().isEmpty())
					ans.setLength(ans.length() - 1);
			} ch == 'B' ch 'B' {
				if (ans.length() == 1)
					ans = new StringBuilder();
				if (!ans.toString().isEmpty())
					ans.setLength(ans.length() - 1);
			} if (ans.length() == 1)
					ans = new StringBuilder(); ans.length() == 1 ans.length() ans.length ans 1 ans = new StringBuilder() ans new StringBuilder() if (!ans.toString().isEmpty())
					ans.setLength(ans.length() - 1); !ans.toString().isEmpty() ans.toString().isEmpty() ans.toString().isEmpty ans.toString() ans.toString ans ans.setLength(ans.length() - 1) ans.setLength ans ans.length() - 1 ans.length() ans.length ans 1 System.out.println(ans.toString()) System.out.println System.out System System.out ans.toString() ans.toString ans String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();

		StringBuilder ans = new StringBuilder();

		for (char ch : c) {
			if (ch == '0')
				ans.append("0");

			if (ch == '1')
				ans.append("1");

			if (ch == 'B') {
				if (ans.length() == 1)
					ans = new StringBuilder();
				if (!ans.toString().isEmpty())
					ans.setLength(ans.length() - 1);
			}
		}

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

	}

} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();

		StringBuilder ans = new StringBuilder();

		for (char ch : c) {
			if (ch == '0')
				ans.append("0");

			if (ch == '1')
				ans.append("1");

			if (ch == 'B') {
				if (ans.length() == 1)
					ans = new StringBuilder();
				if (!ans.toString().isEmpty())
					ans.setLength(ans.length() - 1);
			}
		}

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

	}

} Main


import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();

		StringBuilder ans = new StringBuilder();

		for (char ch : c) {
			if (ch == '0')
				ans.append("0");

			if (ch == '1')
				ans.append("1");

			if (ch == 'B') {
				if (ans.length() == 1)
					ans = new StringBuilder();
				if (!ans.toString().isEmpty())
					ans.setLength(ans.length() - 1);
			}
		}

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

	}

}
