import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		char[] C = sc.next().toCharArray();
		String S = "";
		sc.close();
		for(int i=0;i<C.length;i++) {
			if(C[i]=='B') {if(S.length()>0)S=S.substring(0, S.length()-1);}
			else S+=C[i];
		}
		System.out.println(S);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		char[] C = sc.next().toCharArray();
		String S = "";
		sc.close();
		for(int i=0;i<C.length;i++) {
			if(C[i]=='B') {if(S.length()>0)S=S.substring(0, S.length()-1);}
			else S+=C[i];
		}
		System.out.println(S);
	}
} Main public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	} main {
		Main main = new Main();
		main.solve();
	} Main main = new Main(); main new Main() main.solve() main.solve main String[] args args void solve() {
		Scanner sc = new Scanner(System.in);
		char[] C = sc.next().toCharArray();
		String S = "";
		sc.close();
		for(int i=0;i<C.length;i++) {
			if(C[i]=='B') {if(S.length()>0)S=S.substring(0, S.length()-1);}
			else S+=C[i];
		}
		System.out.println(S);
	} solve {
		Scanner sc = new Scanner(System.in);
		char[] C = sc.next().toCharArray();
		String S = "";
		sc.close();
		for(int i=0;i<C.length;i++) {
			if(C[i]=='B') {if(S.length()>0)S=S.substring(0, S.length()-1);}
			else S+=C[i];
		}
		System.out.println(S);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] C = sc.next().toCharArray(); C sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc String S = ""; S "" sc.close() sc.close sc for(int i=0;i<C.length;i++) {
			if(C[i]=='B') {if(S.length()>0)S=S.substring(0, S.length()-1);}
			else S+=C[i];
		} int i=0; int i=0; i 0 i<C.length i C.length C C.length i++ i++ i {
			if(C[i]=='B') {if(S.length()>0)S=S.substring(0, S.length()-1);}
			else S+=C[i];
		} {
			if(C[i]=='B') {if(S.length()>0)S=S.substring(0, S.length()-1);}
			else S+=C[i];
		} if(C[i]=='B') {if(S.length()>0)S=S.substring(0, S.length()-1);}
			else S+=C[i]; C[i]=='B' C[i] C i 'B' {if(S.length()>0)S=S.substring(0, S.length()-1);} if(S.length()>0)S=S.substring(0, S.length()-1); S.length()>0 S.length() S.length S 0 S=S.substring(0, S.length()-1) S S.substring(0, S.length()-1) S.substring S 0 S.length()-1 S.length() S.length S 1 S+=C[i] S C[i] C i System.out.println(S) System.out.println System.out System System.out S public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		char[] C = sc.next().toCharArray();
		String S = "";
		sc.close();
		for(int i=0;i<C.length;i++) {
			if(C[i]=='B') {if(S.length()>0)S=S.substring(0, S.length()-1);}
			else S+=C[i];
		}
		System.out.println(S);
	}
} public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		char[] C = sc.next().toCharArray();
		String S = "";
		sc.close();
		for(int i=0;i<C.length;i++) {
			if(C[i]=='B') {if(S.length()>0)S=S.substring(0, S.length()-1);}
			else S+=C[i];
		}
		System.out.println(S);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		char[] C = sc.next().toCharArray();
		String S = "";
		sc.close();
		for(int i=0;i<C.length;i++) {
			if(C[i]=='B') {if(S.length()>0)S=S.substring(0, S.length()-1);}
			else S+=C[i];
		}
		System.out.println(S);
	}
}
