import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    String s;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.s = sc.next();
    }
    
    //解答処理
    private String solve() {
        String answer = "";
        for (int i=0; i<s.length(); i++) {
        	if (s.charAt(i) == '0') {
        		answer += "0";
        	} else if (s.charAt(i) == '1') {
        		answer += "1";
        	} else if (s.charAt(i) == 'B' && answer.length() >= 1) {
        		answer = answer.substring(0,answer.length()-1);
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    String s;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.s = sc.next();
    }
    
    //解答処理
    private String solve() {
        String answer = "";
        for (int i=0; i<s.length(); i++) {
        	if (s.charAt(i) == '0') {
        		answer += "0";
        	} else if (s.charAt(i) == '1') {
        		answer += "1";
        	} else if (s.charAt(i) == 'B' && answer.length() >= 1) {
        		answer = answer.substring(0,answer.length()-1);
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

} Main //フィールド
    Scanner sc; sc String s; s public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Main m = new Main(sc); m new Main(sc) m.show(m.solve()) m.show m m.solve() m.solve m sc.close() sc.close sc String[] args args //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.s = sc.next();
    } Main {
        this.sc = sc;
        this.s = sc.next();
    } this.sc = sc this.sc this this.sc sc this.s = sc.next() this.s this this.s sc.next() sc.next sc Scanner sc sc //解答処理
    private String solve() {
        String answer = "";
        for (int i=0; i<s.length(); i++) {
        	if (s.charAt(i) == '0') {
        		answer += "0";
        	} else if (s.charAt(i) == '1') {
        		answer += "1";
        	} else if (s.charAt(i) == 'B' && answer.length() >= 1) {
        		answer = answer.substring(0,answer.length()-1);
        	}
        }
        
        return answer;
    } solve {
        String answer = "";
        for (int i=0; i<s.length(); i++) {
        	if (s.charAt(i) == '0') {
        		answer += "0";
        	} else if (s.charAt(i) == '1') {
        		answer += "1";
        	} else if (s.charAt(i) == 'B' && answer.length() >= 1) {
        		answer = answer.substring(0,answer.length()-1);
        	}
        }
        
        return answer;
    } String answer = ""; answer "" for (int i=0; i<s.length(); i++) {
        	if (s.charAt(i) == '0') {
        		answer += "0";
        	} else if (s.charAt(i) == '1') {
        		answer += "1";
        	} else if (s.charAt(i) == 'B' && answer.length() >= 1) {
        		answer = answer.substring(0,answer.length()-1);
        	}
        } int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
        	if (s.charAt(i) == '0') {
        		answer += "0";
        	} else if (s.charAt(i) == '1') {
        		answer += "1";
        	} else if (s.charAt(i) == 'B' && answer.length() >= 1) {
        		answer = answer.substring(0,answer.length()-1);
        	}
        } {
        	if (s.charAt(i) == '0') {
        		answer += "0";
        	} else if (s.charAt(i) == '1') {
        		answer += "1";
        	} else if (s.charAt(i) == 'B' && answer.length() >= 1) {
        		answer = answer.substring(0,answer.length()-1);
        	}
        } if (s.charAt(i) == '0') {
        		answer += "0";
        	} else if (s.charAt(i) == '1') {
        		answer += "1";
        	} else if (s.charAt(i) == 'B' && answer.length() >= 1) {
        		answer = answer.substring(0,answer.length()-1);
        	} s.charAt(i) == '0' s.charAt(i) s.charAt s i '0' {
        		answer += "0";
        	} answer += "0" answer "0" if (s.charAt(i) == '1') {
        		answer += "1";
        	} else if (s.charAt(i) == 'B' && answer.length() >= 1) {
        		answer = answer.substring(0,answer.length()-1);
        	} s.charAt(i) == '1' s.charAt(i) s.charAt s i '1' {
        		answer += "1";
        	} answer += "1" answer "1" if (s.charAt(i) == 'B' && answer.length() >= 1) {
        		answer = answer.substring(0,answer.length()-1);
        	} s.charAt(i) == 'B' && answer.length() >= 1 s.charAt(i) == 'B' s.charAt(i) s.charAt s i 'B' answer.length() >= 1 answer.length() answer.length answer 1 {
        		answer = answer.substring(0,answer.length()-1);
        	} answer = answer.substring(0,answer.length()-1) answer answer.substring(0,answer.length()-1) answer.substring answer 0 answer.length()-1 answer.length() answer.length answer 1 return answer; answer //出力
    public void show(String answer) {
        System.out.println(answer);
    } show {
        System.out.println(answer);
    } System.out.println(answer) System.out.println System.out System System.out answer String answer answer public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    String s;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.s = sc.next();
    }
    
    //解答処理
    private String solve() {
        String answer = "";
        for (int i=0; i<s.length(); i++) {
        	if (s.charAt(i) == '0') {
        		answer += "0";
        	} else if (s.charAt(i) == '1') {
        		answer += "1";
        	} else if (s.charAt(i) == 'B' && answer.length() >= 1) {
        		answer = answer.substring(0,answer.length()-1);
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

} public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    String s;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.s = sc.next();
    }
    
    //解答処理
    private String solve() {
        String answer = "";
        for (int i=0; i<s.length(); i++) {
        	if (s.charAt(i) == '0') {
        		answer += "0";
        	} else if (s.charAt(i) == '1') {
        		answer += "1";
        	} else if (s.charAt(i) == 'B' && answer.length() >= 1) {
        		answer = answer.substring(0,answer.length()-1);
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    String s;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.s = sc.next();
    }
    
    //解答処理
    private String solve() {
        String answer = "";
        for (int i=0; i<s.length(); i++) {
        	if (s.charAt(i) == '0') {
        		answer += "0";
        	} else if (s.charAt(i) == '1') {
        		answer += "1";
        	} else if (s.charAt(i) == 'B' && answer.length() >= 1) {
        		answer = answer.substring(0,answer.length()-1);
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

}
