import java.util.Scanner;

public class Main {
	public static void main(String[]args){
		
		Scanner scan  = new Scanner(System.in);
		
		String S = scan.next();
		
		
		StringBuilder edit = new StringBuilder();
		
		for(int i = 0;i<S.length();i++){
			switch(S.substring(i, i+1)){
			case "B":
				if(edit.toString().equals("")){
					break;
				}else{
					edit.delete(edit.toString().length()-1, edit.toString().length());
					break;
				}
			case "0":
				edit.append("0");
				break;
				
			case "1":
				edit.append("1");
				break;
			
			}
		}
		
		System.out.println(edit.toString());
		
		
	}
	

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[]args){
		
		Scanner scan  = new Scanner(System.in);
		
		String S = scan.next();
		
		
		StringBuilder edit = new StringBuilder();
		
		for(int i = 0;i<S.length();i++){
			switch(S.substring(i, i+1)){
			case "B":
				if(edit.toString().equals("")){
					break;
				}else{
					edit.delete(edit.toString().length()-1, edit.toString().length());
					break;
				}
			case "0":
				edit.append("0");
				break;
				
			case "1":
				edit.append("1");
				break;
			
			}
		}
		
		System.out.println(edit.toString());
		
		
	}
	

} Main public static void main(String[]args){
		
		Scanner scan  = new Scanner(System.in);
		
		String S = scan.next();
		
		
		StringBuilder edit = new StringBuilder();
		
		for(int i = 0;i<S.length();i++){
			switch(S.substring(i, i+1)){
			case "B":
				if(edit.toString().equals("")){
					break;
				}else{
					edit.delete(edit.toString().length()-1, edit.toString().length());
					break;
				}
			case "0":
				edit.append("0");
				break;
				
			case "1":
				edit.append("1");
				break;
			
			}
		}
		
		System.out.println(edit.toString());
		
		
	} main {
		
		Scanner scan  = new Scanner(System.in);
		
		String S = scan.next();
		
		
		StringBuilder edit = new StringBuilder();
		
		for(int i = 0;i<S.length();i++){
			switch(S.substring(i, i+1)){
			case "B":
				if(edit.toString().equals("")){
					break;
				}else{
					edit.delete(edit.toString().length()-1, edit.toString().length());
					break;
				}
			case "0":
				edit.append("0");
				break;
				
			case "1":
				edit.append("1");
				break;
			
			}
		}
		
		System.out.println(edit.toString());
		
		
	} Scanner scan  = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan StringBuilder edit = new StringBuilder(); edit new StringBuilder() for(int i = 0;i<S.length();i++){
			switch(S.substring(i, i+1)){
			case "B":
				if(edit.toString().equals("")){
					break;
				}else{
					edit.delete(edit.toString().length()-1, edit.toString().length());
					break;
				}
			case "0":
				edit.append("0");
				break;
				
			case "1":
				edit.append("1");
				break;
			
			}
		} int i = 0; int i = 0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
			switch(S.substring(i, i+1)){
			case "B":
				if(edit.toString().equals("")){
					break;
				}else{
					edit.delete(edit.toString().length()-1, edit.toString().length());
					break;
				}
			case "0":
				edit.append("0");
				break;
				
			case "1":
				edit.append("1");
				break;
			
			}
		} {
			switch(S.substring(i, i+1)){
			case "B":
				if(edit.toString().equals("")){
					break;
				}else{
					edit.delete(edit.toString().length()-1, edit.toString().length());
					break;
				}
			case "0":
				edit.append("0");
				break;
				
			case "1":
				edit.append("1");
				break;
			
			}
		} switch(S.substring(i, i+1)){
			case "B":
				if(edit.toString().equals("")){
					break;
				}else{
					edit.delete(edit.toString().length()-1, edit.toString().length());
					break;
				}
			case "0":
				edit.append("0");
				break;
				
			case "1":
				edit.append("1");
				break;
			
			} S.substring(i, i+1) S.substring S i i+1 i 1 case "B": "B" case "B": if(edit.toString().equals("")){
					break;
				}else{
					edit.delete(edit.toString().length()-1, edit.toString().length());
					break;
				} edit.toString().equals("") edit.toString().equals edit.toString() edit.toString edit "" {
					break;
				} break; {
					edit.delete(edit.toString().length()-1, edit.toString().length());
					break;
				} edit.delete(edit.toString().length()-1, edit.toString().length()) edit.delete edit edit.toString().length()-1 edit.toString().length() edit.toString().length edit.toString() edit.toString edit 1 edit.toString().length() edit.toString().length edit.toString() edit.toString edit break; case "0": "0" case "0": edit.append("0") edit.append edit "0" break; case "1": "1" case "1": edit.append("1") edit.append edit "1" break; System.out.println(edit.toString()) System.out.println System.out System System.out edit.toString() edit.toString edit String[]args args public class Main {
	public static void main(String[]args){
		
		Scanner scan  = new Scanner(System.in);
		
		String S = scan.next();
		
		
		StringBuilder edit = new StringBuilder();
		
		for(int i = 0;i<S.length();i++){
			switch(S.substring(i, i+1)){
			case "B":
				if(edit.toString().equals("")){
					break;
				}else{
					edit.delete(edit.toString().length()-1, edit.toString().length());
					break;
				}
			case "0":
				edit.append("0");
				break;
				
			case "1":
				edit.append("1");
				break;
			
			}
		}
		
		System.out.println(edit.toString());
		
		
	}
	

} public class Main {
	public static void main(String[]args){
		
		Scanner scan  = new Scanner(System.in);
		
		String S = scan.next();
		
		
		StringBuilder edit = new StringBuilder();
		
		for(int i = 0;i<S.length();i++){
			switch(S.substring(i, i+1)){
			case "B":
				if(edit.toString().equals("")){
					break;
				}else{
					edit.delete(edit.toString().length()-1, edit.toString().length());
					break;
				}
			case "0":
				edit.append("0");
				break;
				
			case "1":
				edit.append("1");
				break;
			
			}
		}
		
		System.out.println(edit.toString());
		
		
	}
	

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[]args){
		
		Scanner scan  = new Scanner(System.in);
		
		String S = scan.next();
		
		
		StringBuilder edit = new StringBuilder();
		
		for(int i = 0;i<S.length();i++){
			switch(S.substring(i, i+1)){
			case "B":
				if(edit.toString().equals("")){
					break;
				}else{
					edit.delete(edit.toString().length()-1, edit.toString().length());
					break;
				}
			case "0":
				edit.append("0");
				break;
				
			case "1":
				edit.append("1");
				break;
			
			}
		}
		
		System.out.println(edit.toString());
		
		
	}
	

}
