import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder answer = new StringBuilder("");
		char list[] = s.toCharArray();
		for (int i = 0; i < s.length(); i++) {
			char c = list[i];
			switch(c) {
				case '0':
					answer.append("0");
					break;
				case '1':
					answer.append("1");
					break;
				case 'B':
					if(answer.length() == 0) {
						break;
					}else {
						answer.deleteCharAt(answer.length()-1);
						break;
					}
			}
		}
		System.out.println(answer.toString());
		sc.close();
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder answer = new StringBuilder("");
		char list[] = s.toCharArray();
		for (int i = 0; i < s.length(); i++) {
			char c = list[i];
			switch(c) {
				case '0':
					answer.append("0");
					break;
				case '1':
					answer.append("1");
					break;
				case 'B':
					if(answer.length() == 0) {
						break;
					}else {
						answer.deleteCharAt(answer.length()-1);
						break;
					}
			}
		}
		System.out.println(answer.toString());
		sc.close();
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder answer = new StringBuilder("");
		char list[] = s.toCharArray();
		for (int i = 0; i < s.length(); i++) {
			char c = list[i];
			switch(c) {
				case '0':
					answer.append("0");
					break;
				case '1':
					answer.append("1");
					break;
				case 'B':
					if(answer.length() == 0) {
						break;
					}else {
						answer.deleteCharAt(answer.length()-1);
						break;
					}
			}
		}
		System.out.println(answer.toString());
		sc.close();
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder answer = new StringBuilder("");
		char list[] = s.toCharArray();
		for (int i = 0; i < s.length(); i++) {
			char c = list[i];
			switch(c) {
				case '0':
					answer.append("0");
					break;
				case '1':
					answer.append("1");
					break;
				case 'B':
					if(answer.length() == 0) {
						break;
					}else {
						answer.deleteCharAt(answer.length()-1);
						break;
					}
			}
		}
		System.out.println(answer.toString());
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc StringBuilder answer = new StringBuilder(""); answer new StringBuilder("") char list[] = s.toCharArray(); list s.toCharArray() s.toCharArray s for (int i = 0; i < s.length(); i++) {
			char c = list[i];
			switch(c) {
				case '0':
					answer.append("0");
					break;
				case '1':
					answer.append("1");
					break;
				case 'B':
					if(answer.length() == 0) {
						break;
					}else {
						answer.deleteCharAt(answer.length()-1);
						break;
					}
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			char c = list[i];
			switch(c) {
				case '0':
					answer.append("0");
					break;
				case '1':
					answer.append("1");
					break;
				case 'B':
					if(answer.length() == 0) {
						break;
					}else {
						answer.deleteCharAt(answer.length()-1);
						break;
					}
			}
		} {
			char c = list[i];
			switch(c) {
				case '0':
					answer.append("0");
					break;
				case '1':
					answer.append("1");
					break;
				case 'B':
					if(answer.length() == 0) {
						break;
					}else {
						answer.deleteCharAt(answer.length()-1);
						break;
					}
			}
		} char c = list[i]; c list[i] list i switch(c) {
				case '0':
					answer.append("0");
					break;
				case '1':
					answer.append("1");
					break;
				case 'B':
					if(answer.length() == 0) {
						break;
					}else {
						answer.deleteCharAt(answer.length()-1);
						break;
					}
			} c case '0': '0' case '0': answer.append("0") answer.append answer "0" break; case '1': '1' case '1': answer.append("1") answer.append answer "1" break; case 'B': 'B' case 'B': if(answer.length() == 0) {
						break;
					}else {
						answer.deleteCharAt(answer.length()-1);
						break;
					} answer.length() == 0 answer.length() answer.length answer 0 {
						break;
					} break; {
						answer.deleteCharAt(answer.length()-1);
						break;
					} answer.deleteCharAt(answer.length()-1) answer.deleteCharAt answer answer.length()-1 answer.length() answer.length answer 1 break; System.out.println(answer.toString()) System.out.println System.out System System.out answer.toString() answer.toString answer sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder answer = new StringBuilder("");
		char list[] = s.toCharArray();
		for (int i = 0; i < s.length(); i++) {
			char c = list[i];
			switch(c) {
				case '0':
					answer.append("0");
					break;
				case '1':
					answer.append("1");
					break;
				case 'B':
					if(answer.length() == 0) {
						break;
					}else {
						answer.deleteCharAt(answer.length()-1);
						break;
					}
			}
		}
		System.out.println(answer.toString());
		sc.close();
	}

} public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder answer = new StringBuilder("");
		char list[] = s.toCharArray();
		for (int i = 0; i < s.length(); i++) {
			char c = list[i];
			switch(c) {
				case '0':
					answer.append("0");
					break;
				case '1':
					answer.append("1");
					break;
				case 'B':
					if(answer.length() == 0) {
						break;
					}else {
						answer.deleteCharAt(answer.length()-1);
						break;
					}
			}
		}
		System.out.println(answer.toString());
		sc.close();
	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder answer = new StringBuilder("");
		char list[] = s.toCharArray();
		for (int i = 0; i < s.length(); i++) {
			char c = list[i];
			switch(c) {
				case '0':
					answer.append("0");
					break;
				case '1':
					answer.append("1");
					break;
				case 'B':
					if(answer.length() == 0) {
						break;
					}else {
						answer.deleteCharAt(answer.length()-1);
						break;
					}
			}
		}
		System.out.println(answer.toString());
		sc.close();
	}

}