import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] s = in.next().toCharArray();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == 'B') {
				if (ans.length() > 0) {
					ans.delete(ans.length() - 1, ans.length());
				}
			} else {
				ans.append(s[i]);
			}
		}
		System.out.println(ans.toString());
		in.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] s = in.next().toCharArray();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == 'B') {
				if (ans.length() > 0) {
					ans.delete(ans.length() - 1, ans.length());
				}
			} else {
				ans.append(s[i]);
			}
		}
		System.out.println(ans.toString());
		in.close();
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] s = in.next().toCharArray();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == 'B') {
				if (ans.length() > 0) {
					ans.delete(ans.length() - 1, ans.length());
				}
			} else {
				ans.append(s[i]);
			}
		}
		System.out.println(ans.toString());
		in.close();
	} main {
		Scanner in = new Scanner(System.in);
		char[] s = in.next().toCharArray();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == 'B') {
				if (ans.length() > 0) {
					ans.delete(ans.length() - 1, ans.length());
				}
			} else {
				ans.append(s[i]);
			}
		}
		System.out.println(ans.toString());
		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) char[] s = in.next().toCharArray(); s in.next().toCharArray() in.next().toCharArray in.next() in.next in StringBuilder ans = new StringBuilder(); ans new StringBuilder() for (int i = 0; i < s.length; i++) {
			if (s[i] == 'B') {
				if (ans.length() > 0) {
					ans.delete(ans.length() - 1, ans.length());
				}
			} else {
				ans.append(s[i]);
			}
		} int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
			if (s[i] == 'B') {
				if (ans.length() > 0) {
					ans.delete(ans.length() - 1, ans.length());
				}
			} else {
				ans.append(s[i]);
			}
		} {
			if (s[i] == 'B') {
				if (ans.length() > 0) {
					ans.delete(ans.length() - 1, ans.length());
				}
			} else {
				ans.append(s[i]);
			}
		} if (s[i] == 'B') {
				if (ans.length() > 0) {
					ans.delete(ans.length() - 1, ans.length());
				}
			} else {
				ans.append(s[i]);
			} s[i] == 'B' s[i] s i 'B' {
				if (ans.length() > 0) {
					ans.delete(ans.length() - 1, ans.length());
				}
			} if (ans.length() > 0) {
					ans.delete(ans.length() - 1, ans.length());
				} ans.length() > 0 ans.length() ans.length ans 0 {
					ans.delete(ans.length() - 1, ans.length());
				} ans.delete(ans.length() - 1, ans.length()) ans.delete ans ans.length() - 1 ans.length() ans.length ans 1 ans.length() ans.length ans {
				ans.append(s[i]);
			} ans.append(s[i]) ans.append ans s[i] s i System.out.println(ans.toString()) System.out.println System.out System System.out ans.toString() ans.toString ans in.close() in.close in String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] s = in.next().toCharArray();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == 'B') {
				if (ans.length() > 0) {
					ans.delete(ans.length() - 1, ans.length());
				}
			} else {
				ans.append(s[i]);
			}
		}
		System.out.println(ans.toString());
		in.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] s = in.next().toCharArray();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == 'B') {
				if (ans.length() > 0) {
					ans.delete(ans.length() - 1, ans.length());
				}
			} else {
				ans.append(s[i]);
			}
		}
		System.out.println(ans.toString());
		in.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] s = in.next().toCharArray();
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == 'B') {
				if (ans.length() > 0) {
					ans.delete(ans.length() - 1, ans.length());
				}
			} else {
				ans.append(s[i]);
			}
		}
		System.out.println(ans.toString());
		in.close();
	}
}