import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder str = new StringBuilder();

		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(str.length()!=0) {
					str.deleteCharAt(str.length()-1);
				}
			}else {
				str.append(s.charAt(i));
			}
		}
		System.out.println(str);
		/*if(N!=0) {
			System.out.println("Yes");//Yes or YES注意！！
		}else {
			System.out.println("No");//No or NO注意！！
		}*/

	}
	public static int sample(int n) {
		return n;
	}

} 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();
		StringBuilder str = new StringBuilder();

		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(str.length()!=0) {
					str.deleteCharAt(str.length()-1);
				}
			}else {
				str.append(s.charAt(i));
			}
		}
		System.out.println(str);
		/*if(N!=0) {
			System.out.println("Yes");//Yes or YES注意！！
		}else {
			System.out.println("No");//No or NO注意！！
		}*/

	}
	public static int sample(int n) {
		return n;
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder str = new StringBuilder();

		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(str.length()!=0) {
					str.deleteCharAt(str.length()-1);
				}
			}else {
				str.append(s.charAt(i));
			}
		}
		System.out.println(str);
		/*if(N!=0) {
			System.out.println("Yes");//Yes or YES注意！！
		}else {
			System.out.println("No");//No or NO注意！！
		}*/

	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder str = new StringBuilder();

		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(str.length()!=0) {
					str.deleteCharAt(str.length()-1);
				}
			}else {
				str.append(s.charAt(i));
			}
		}
		System.out.println(str);
		/*if(N!=0) {
			System.out.println("Yes");//Yes or YES注意！！
		}else {
			System.out.println("No");//No or NO注意！！
		}*/

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc StringBuilder str = new StringBuilder(); str new StringBuilder() for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(str.length()!=0) {
					str.deleteCharAt(str.length()-1);
				}
			}else {
				str.append(s.charAt(i));
			}
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			if(s.charAt(i)=='B') {
				if(str.length()!=0) {
					str.deleteCharAt(str.length()-1);
				}
			}else {
				str.append(s.charAt(i));
			}
		} {
			if(s.charAt(i)=='B') {
				if(str.length()!=0) {
					str.deleteCharAt(str.length()-1);
				}
			}else {
				str.append(s.charAt(i));
			}
		} if(s.charAt(i)=='B') {
				if(str.length()!=0) {
					str.deleteCharAt(str.length()-1);
				}
			}else {
				str.append(s.charAt(i));
			} s.charAt(i)=='B' s.charAt(i) s.charAt s i 'B' {
				if(str.length()!=0) {
					str.deleteCharAt(str.length()-1);
				}
			} if(str.length()!=0) {
					str.deleteCharAt(str.length()-1);
				} str.length()!=0 str.length() str.length str 0 {
					str.deleteCharAt(str.length()-1);
				} str.deleteCharAt(str.length()-1) str.deleteCharAt str str.length()-1 str.length() str.length str 1 {
				str.append(s.charAt(i));
			} str.append(s.charAt(i)) str.append str s.charAt(i) s.charAt s i System.out.println(str) System.out.println System.out System System.out str String[] args args public static int sample(int n) {
		return n;
	} sample {
		return n;
	} return n; n int n n public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder str = new StringBuilder();

		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(str.length()!=0) {
					str.deleteCharAt(str.length()-1);
				}
			}else {
				str.append(s.charAt(i));
			}
		}
		System.out.println(str);
		/*if(N!=0) {
			System.out.println("Yes");//Yes or YES注意！！
		}else {
			System.out.println("No");//No or NO注意！！
		}*/

	}
	public static int sample(int n) {
		return n;
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder str = new StringBuilder();

		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(str.length()!=0) {
					str.deleteCharAt(str.length()-1);
				}
			}else {
				str.append(s.charAt(i));
			}
		}
		System.out.println(str);
		/*if(N!=0) {
			System.out.println("Yes");//Yes or YES注意！！
		}else {
			System.out.println("No");//No or NO注意！！
		}*/

	}
	public static int sample(int n) {
		return n;
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder str = new StringBuilder();

		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(str.length()!=0) {
					str.deleteCharAt(str.length()-1);
				}
			}else {
				str.append(s.charAt(i));
			}
		}
		System.out.println(str);
		/*if(N!=0) {
			System.out.println("Yes");//Yes or YES注意！！
		}else {
			System.out.println("No");//No or NO注意！！
		}*/

	}
	public static int sample(int n) {
		return n;
	}

}
