import java.util.*;

class Main{
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	String a = "";
	for(int i = 0; i < s.length(); i++) {
		switch(s.charAt(i)) {
		case '0':
			a += "0";
			break;
		case '1':
			a += "1";
			break;
		case 'B':
			if(a.length() > 0) {
				a = a.substring(0, a.length() - 1);
			}
			break;
		}
	}
	System.out.println(a);
}
} import java.util.*; util.* java class Main{
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	String a = "";
	for(int i = 0; i < s.length(); i++) {
		switch(s.charAt(i)) {
		case '0':
			a += "0";
			break;
		case '1':
			a += "1";
			break;
		case 'B':
			if(a.length() > 0) {
				a = a.substring(0, a.length() - 1);
			}
			break;
		}
	}
	System.out.println(a);
}
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	String a = "";
	for(int i = 0; i < s.length(); i++) {
		switch(s.charAt(i)) {
		case '0':
			a += "0";
			break;
		case '1':
			a += "1";
			break;
		case 'B':
			if(a.length() > 0) {
				a = a.substring(0, a.length() - 1);
			}
			break;
		}
	}
	System.out.println(a);
} main {
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	String a = "";
	for(int i = 0; i < s.length(); i++) {
		switch(s.charAt(i)) {
		case '0':
			a += "0";
			break;
		case '1':
			a += "1";
			break;
		case 'B':
			if(a.length() > 0) {
				a = a.substring(0, a.length() - 1);
			}
			break;
		}
	}
	System.out.println(a);
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String a = ""; a "" for(int i = 0; i < s.length(); i++) {
		switch(s.charAt(i)) {
		case '0':
			a += "0";
			break;
		case '1':
			a += "1";
			break;
		case 'B':
			if(a.length() > 0) {
				a = a.substring(0, a.length() - 1);
			}
			break;
		}
	} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
		switch(s.charAt(i)) {
		case '0':
			a += "0";
			break;
		case '1':
			a += "1";
			break;
		case 'B':
			if(a.length() > 0) {
				a = a.substring(0, a.length() - 1);
			}
			break;
		}
	} {
		switch(s.charAt(i)) {
		case '0':
			a += "0";
			break;
		case '1':
			a += "1";
			break;
		case 'B':
			if(a.length() > 0) {
				a = a.substring(0, a.length() - 1);
			}
			break;
		}
	} switch(s.charAt(i)) {
		case '0':
			a += "0";
			break;
		case '1':
			a += "1";
			break;
		case 'B':
			if(a.length() > 0) {
				a = a.substring(0, a.length() - 1);
			}
			break;
		} s.charAt(i) s.charAt s i case '0': '0' case '0': a += "0" a "0" break; case '1': '1' case '1': a += "1" a "1" break; case 'B': 'B' case 'B': if(a.length() > 0) {
				a = a.substring(0, a.length() - 1);
			} a.length() > 0 a.length() a.length a 0 {
				a = a.substring(0, a.length() - 1);
			} a = a.substring(0, a.length() - 1) a a.substring(0, a.length() - 1) a.substring a 0 a.length() - 1 a.length() a.length a 1 break; System.out.println(a) System.out.println System.out System System.out a String[] args args
import java.util.*;

class Main{
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	String a = "";
	for(int i = 0; i < s.length(); i++) {
		switch(s.charAt(i)) {
		case '0':
			a += "0";
			break;
		case '1':
			a += "1";
			break;
		case 'B':
			if(a.length() > 0) {
				a = a.substring(0, a.length() - 1);
			}
			break;
		}
	}
	System.out.println(a);
}
}