import java.util.Scanner;

class Main {

	public static void main(String args[]){

		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < s.length(); i++){
			
			
			switch(s.charAt(i)){
			case '0':sb.append('0');
			break;
			case '1':sb.append('1');
			break;
			case 'B':if(sb.length() != 0)sb.deleteCharAt(sb.length()-1);
			}
		}
		System.out.print(sb.toString());
		
	}

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

	public static void main(String args[]){

		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < s.length(); i++){
			
			
			switch(s.charAt(i)){
			case '0':sb.append('0');
			break;
			case '1':sb.append('1');
			break;
			case 'B':if(sb.length() != 0)sb.deleteCharAt(sb.length()-1);
			}
		}
		System.out.print(sb.toString());
		
	}

} Main public static void main(String args[]){

		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < s.length(); i++){
			
			
			switch(s.charAt(i)){
			case '0':sb.append('0');
			break;
			case '1':sb.append('1');
			break;
			case 'B':if(sb.length() != 0)sb.deleteCharAt(sb.length()-1);
			}
		}
		System.out.print(sb.toString());
		
	} main {

		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < s.length(); i++){
			
			
			switch(s.charAt(i)){
			case '0':sb.append('0');
			break;
			case '1':sb.append('1');
			break;
			case 'B':if(sb.length() != 0)sb.deleteCharAt(sb.length()-1);
			}
		}
		System.out.print(sb.toString());
		
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0; i < s.length(); i++){
			
			
			switch(s.charAt(i)){
			case '0':sb.append('0');
			break;
			case '1':sb.append('1');
			break;
			case 'B':if(sb.length() != 0)sb.deleteCharAt(sb.length()-1);
			}
		} 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':sb.append('0');
			break;
			case '1':sb.append('1');
			break;
			case 'B':if(sb.length() != 0)sb.deleteCharAt(sb.length()-1);
			}
		} {
			
			
			switch(s.charAt(i)){
			case '0':sb.append('0');
			break;
			case '1':sb.append('1');
			break;
			case 'B':if(sb.length() != 0)sb.deleteCharAt(sb.length()-1);
			}
		} switch(s.charAt(i)){
			case '0':sb.append('0');
			break;
			case '1':sb.append('1');
			break;
			case 'B':if(sb.length() != 0)sb.deleteCharAt(sb.length()-1);
			} s.charAt(i) s.charAt s i case '0': '0' case '0': sb.append('0') sb.append sb '0' break; case '1': '1' case '1': sb.append('1') sb.append sb '1' break; case 'B': 'B' case 'B': if(sb.length() != 0)sb.deleteCharAt(sb.length()-1); sb.length() != 0 sb.length() sb.length sb 0 sb.deleteCharAt(sb.length()-1) sb.deleteCharAt sb sb.length()-1 sb.length() sb.length sb 1 System.out.print(sb.toString()) System.out.print System.out System System.out sb.toString() sb.toString sb String args[] args
import java.util.Scanner;

class Main {

	public static void main(String args[]){

		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < s.length(); i++){
			
			
			switch(s.charAt(i)){
			case '0':sb.append('0');
			break;
			case '1':sb.append('1');
			break;
			case 'B':if(sb.length() != 0)sb.deleteCharAt(sb.length()-1);
			}
		}
		System.out.print(sb.toString());
		
	}

}
