import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String result="";
		char[] c = s.toCharArray();
		for(int i=0;i<c.length;i++) {
			switch(c[i]) {
			case '0':
				result += "0";
				break;
			case '1':
				result += "1";
				break;
			case 'B':
				if(!result.equals("")) {
					result = result.substring(0,result.length()-1);
				}
				break;
			}
		}
		System.out.println(result);
		scanner.close();
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String result="";
		char[] c = s.toCharArray();
		for(int i=0;i<c.length;i++) {
			switch(c[i]) {
			case '0':
				result += "0";
				break;
			case '1':
				result += "1";
				break;
			case 'B':
				if(!result.equals("")) {
					result = result.substring(0,result.length()-1);
				}
				break;
			}
		}
		System.out.println(result);
		scanner.close();
	}

} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String result="";
		char[] c = s.toCharArray();
		for(int i=0;i<c.length;i++) {
			switch(c[i]) {
			case '0':
				result += "0";
				break;
			case '1':
				result += "1";
				break;
			case 'B':
				if(!result.equals("")) {
					result = result.substring(0,result.length()-1);
				}
				break;
			}
		}
		System.out.println(result);
		scanner.close();
	} main {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String result="";
		char[] c = s.toCharArray();
		for(int i=0;i<c.length;i++) {
			switch(c[i]) {
			case '0':
				result += "0";
				break;
			case '1':
				result += "1";
				break;
			case 'B':
				if(!result.equals("")) {
					result = result.substring(0,result.length()-1);
				}
				break;
			}
		}
		System.out.println(result);
		scanner.close();
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner String result=""; result "" char[] c = s.toCharArray(); c s.toCharArray() s.toCharArray s for(int i=0;i<c.length;i++) {
			switch(c[i]) {
			case '0':
				result += "0";
				break;
			case '1':
				result += "1";
				break;
			case 'B':
				if(!result.equals("")) {
					result = result.substring(0,result.length()-1);
				}
				break;
			}
		} int i=0; int i=0; i 0 i<c.length i c.length c c.length i++ i++ i {
			switch(c[i]) {
			case '0':
				result += "0";
				break;
			case '1':
				result += "1";
				break;
			case 'B':
				if(!result.equals("")) {
					result = result.substring(0,result.length()-1);
				}
				break;
			}
		} {
			switch(c[i]) {
			case '0':
				result += "0";
				break;
			case '1':
				result += "1";
				break;
			case 'B':
				if(!result.equals("")) {
					result = result.substring(0,result.length()-1);
				}
				break;
			}
		} switch(c[i]) {
			case '0':
				result += "0";
				break;
			case '1':
				result += "1";
				break;
			case 'B':
				if(!result.equals("")) {
					result = result.substring(0,result.length()-1);
				}
				break;
			} c[i] c i case '0': '0' case '0': result += "0" result "0" break; case '1': '1' case '1': result += "1" result "1" break; case 'B': 'B' case 'B': if(!result.equals("")) {
					result = result.substring(0,result.length()-1);
				} !result.equals("") result.equals("") result.equals result "" {
					result = result.substring(0,result.length()-1);
				} result = result.substring(0,result.length()-1) result result.substring(0,result.length()-1) result.substring result 0 result.length()-1 result.length() result.length result 1 break; System.out.println(result) System.out.println System.out System System.out result scanner.close() scanner.close scanner String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String result="";
		char[] c = s.toCharArray();
		for(int i=0;i<c.length;i++) {
			switch(c[i]) {
			case '0':
				result += "0";
				break;
			case '1':
				result += "1";
				break;
			case 'B':
				if(!result.equals("")) {
					result = result.substring(0,result.length()-1);
				}
				break;
			}
		}
		System.out.println(result);
		scanner.close();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String result="";
		char[] c = s.toCharArray();
		for(int i=0;i<c.length;i++) {
			switch(c[i]) {
			case '0':
				result += "0";
				break;
			case '1':
				result += "1";
				break;
			case 'B':
				if(!result.equals("")) {
					result = result.substring(0,result.length()-1);
				}
				break;
			}
		}
		System.out.println(result);
		scanner.close();
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String result="";
		char[] c = s.toCharArray();
		for(int i=0;i<c.length;i++) {
			switch(c[i]) {
			case '0':
				result += "0";
				break;
			case '1':
				result += "1";
				break;
			case 'B':
				if(!result.equals("")) {
					result = result.substring(0,result.length()-1);
				}
				break;
			}
		}
		System.out.println(result);
		scanner.close();
	}

}
