import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			String S = sc.next();
			char[] s = S.toCharArray();
			String nS = "";
			List<Integer> a = new ArrayList<Integer>();
			
			for(int i=0;i<S.length();i++) {
				if(s[i]!='B') {
					nS += s[i];
				}else if(!nS.equals("")) {
					nS = nS.substring(0, nS.length()-1);
					
				}
				
			}
			System.out.println(nS);
			
		}

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

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			String S = sc.next();
			char[] s = S.toCharArray();
			String nS = "";
			List<Integer> a = new ArrayList<Integer>();
			
			for(int i=0;i<S.length();i++) {
				if(s[i]!='B') {
					nS += s[i];
				}else if(!nS.equals("")) {
					nS = nS.substring(0, nS.length()-1);
					
				}
				
			}
			System.out.println(nS);
			
		}

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

			Scanner sc = new Scanner(System.in);

			String S = sc.next();
			char[] s = S.toCharArray();
			String nS = "";
			List<Integer> a = new ArrayList<Integer>();
			
			for(int i=0;i<S.length();i++) {
				if(s[i]!='B') {
					nS += s[i];
				}else if(!nS.equals("")) {
					nS = nS.substring(0, nS.length()-1);
					
				}
				
			}
			System.out.println(nS);
			
		} main {

			Scanner sc = new Scanner(System.in);

			String S = sc.next();
			char[] s = S.toCharArray();
			String nS = "";
			List<Integer> a = new ArrayList<Integer>();
			
			for(int i=0;i<S.length();i++) {
				if(s[i]!='B') {
					nS += s[i];
				}else if(!nS.equals("")) {
					nS = nS.substring(0, nS.length()-1);
					
				}
				
			}
			System.out.println(nS);
			
		} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc char[] s = S.toCharArray(); s S.toCharArray() S.toCharArray S String nS = ""; nS "" List<Integer> a = new ArrayList<Integer>(); a new ArrayList<Integer>() for(int i=0;i<S.length();i++) {
				if(s[i]!='B') {
					nS += s[i];
				}else if(!nS.equals("")) {
					nS = nS.substring(0, nS.length()-1);
					
				}
				
			} int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
				if(s[i]!='B') {
					nS += s[i];
				}else if(!nS.equals("")) {
					nS = nS.substring(0, nS.length()-1);
					
				}
				
			} {
				if(s[i]!='B') {
					nS += s[i];
				}else if(!nS.equals("")) {
					nS = nS.substring(0, nS.length()-1);
					
				}
				
			} if(s[i]!='B') {
					nS += s[i];
				}else if(!nS.equals("")) {
					nS = nS.substring(0, nS.length()-1);
					
				} s[i]!='B' s[i] s i 'B' {
					nS += s[i];
				} nS += s[i] nS s[i] s i if(!nS.equals("")) {
					nS = nS.substring(0, nS.length()-1);
					
				} !nS.equals("") nS.equals("") nS.equals nS "" {
					nS = nS.substring(0, nS.length()-1);
					
				} nS = nS.substring(0, nS.length()-1) nS nS.substring(0, nS.length()-1) nS.substring nS 0 nS.length()-1 nS.length() nS.length nS 1 System.out.println(nS) System.out.println System.out System System.out nS String[] args args public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			String S = sc.next();
			char[] s = S.toCharArray();
			String nS = "";
			List<Integer> a = new ArrayList<Integer>();
			
			for(int i=0;i<S.length();i++) {
				if(s[i]!='B') {
					nS += s[i];
				}else if(!nS.equals("")) {
					nS = nS.substring(0, nS.length()-1);
					
				}
				
			}
			System.out.println(nS);
			
		}

	} public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			String S = sc.next();
			char[] s = S.toCharArray();
			String nS = "";
			List<Integer> a = new ArrayList<Integer>();
			
			for(int i=0;i<S.length();i++) {
				if(s[i]!='B') {
					nS += s[i];
				}else if(!nS.equals("")) {
					nS = nS.substring(0, nS.length()-1);
					
				}
				
			}
			System.out.println(nS);
			
		}

	} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			String S = sc.next();
			char[] s = S.toCharArray();
			String nS = "";
			List<Integer> a = new ArrayList<Integer>();
			
			for(int i=0;i<S.length();i++) {
				if(s[i]!='B') {
					nS += s[i];
				}else if(!nS.equals("")) {
					nS = nS.substring(0, nS.length()-1);
					
				}
				
			}
			System.out.println(nS);
			
		}

	}
