import java.util.*;
import java.io.*;

class Main {
	public static void main (String[] args) throws IOException {
	    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    String s = in.readLine();
	    
	    String res = "";
	    
	    for (int i = 0; i < s.length(); i++) {
	        char c = s.charAt(i);
	        if (c == '0') {
	            res += "0";
	        }
	        if (c == '1') {
	            res += "1";
	        }
	        if (c == 'B' && res.length() > 0) {
	            res = res.substring(0, res.length() - 1);
	        }
	    }
	    System.out.println(res);
	    
	    in.close();
	}
} import java.util.*; util.* java import java.io.*; io.* java class Main {
	public static void main (String[] args) throws IOException {
	    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    String s = in.readLine();
	    
	    String res = "";
	    
	    for (int i = 0; i < s.length(); i++) {
	        char c = s.charAt(i);
	        if (c == '0') {
	            res += "0";
	        }
	        if (c == '1') {
	            res += "1";
	        }
	        if (c == 'B' && res.length() > 0) {
	            res = res.substring(0, res.length() - 1);
	        }
	    }
	    System.out.println(res);
	    
	    in.close();
	}
} Main public static void main (String[] args) throws IOException {
	    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    String s = in.readLine();
	    
	    String res = "";
	    
	    for (int i = 0; i < s.length(); i++) {
	        char c = s.charAt(i);
	        if (c == '0') {
	            res += "0";
	        }
	        if (c == '1') {
	            res += "1";
	        }
	        if (c == 'B' && res.length() > 0) {
	            res = res.substring(0, res.length() - 1);
	        }
	    }
	    System.out.println(res);
	    
	    in.close();
	} main {
	    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    String s = in.readLine();
	    
	    String res = "";
	    
	    for (int i = 0; i < s.length(); i++) {
	        char c = s.charAt(i);
	        if (c == '0') {
	            res += "0";
	        }
	        if (c == '1') {
	            res += "1";
	        }
	        if (c == 'B' && res.length() > 0) {
	            res = res.substring(0, res.length() - 1);
	        }
	    }
	    System.out.println(res);
	    
	    in.close();
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String s = in.readLine(); s in.readLine() in.readLine in String res = ""; res "" for (int i = 0; i < s.length(); i++) {
	        char c = s.charAt(i);
	        if (c == '0') {
	            res += "0";
	        }
	        if (c == '1') {
	            res += "1";
	        }
	        if (c == 'B' && res.length() > 0) {
	            res = res.substring(0, res.length() - 1);
	        }
	    } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
	        char c = s.charAt(i);
	        if (c == '0') {
	            res += "0";
	        }
	        if (c == '1') {
	            res += "1";
	        }
	        if (c == 'B' && res.length() > 0) {
	            res = res.substring(0, res.length() - 1);
	        }
	    } {
	        char c = s.charAt(i);
	        if (c == '0') {
	            res += "0";
	        }
	        if (c == '1') {
	            res += "1";
	        }
	        if (c == 'B' && res.length() > 0) {
	            res = res.substring(0, res.length() - 1);
	        }
	    } char c = s.charAt(i); c s.charAt(i) s.charAt s i if (c == '0') {
	            res += "0";
	        } c == '0' c '0' {
	            res += "0";
	        } res += "0" res "0" if (c == '1') {
	            res += "1";
	        } c == '1' c '1' {
	            res += "1";
	        } res += "1" res "1" if (c == 'B' && res.length() > 0) {
	            res = res.substring(0, res.length() - 1);
	        } c == 'B' && res.length() > 0 c == 'B' c 'B' res.length() > 0 res.length() res.length res 0 {
	            res = res.substring(0, res.length() - 1);
	        } res = res.substring(0, res.length() - 1) res res.substring(0, res.length() - 1) res.substring res 0 res.length() - 1 res.length() res.length res 1 System.out.println(res) System.out.println System.out System System.out res in.close() in.close in String[] args args
import java.util.*;
import java.io.*;

class Main {
	public static void main (String[] args) throws IOException {
	    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    String s = in.readLine();
	    
	    String res = "";
	    
	    for (int i = 0; i < s.length(); i++) {
	        char c = s.charAt(i);
	        if (c == '0') {
	            res += "0";
	        }
	        if (c == '1') {
	            res += "1";
	        }
	        if (c == 'B' && res.length() > 0) {
	            res = res.substring(0, res.length() - 1);
	        }
	    }
	    System.out.println(res);
	    
	    in.close();
	}
}