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