import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Stack<Character> stack = new Stack<Character>();
		String s = sc.next();
		for(int i=0;i<s.length();i++) {
			if (s.charAt(i)=='B') {
				if (stack.isEmpty()==false) {
					stack.pop();
				}
			} else {
				stack.add(s.charAt(i));
			}
		}
		Stack<Character> result = new Stack<Character>();
		while (stack.isEmpty()==false) {
			Character c = stack.pop();
			result.add(c);
		}
		while (result.isEmpty()==false) {
			System.out.print(result.pop());
		}
	}
} import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Stack<Character> stack = new Stack<Character>();
		String s = sc.next();
		for(int i=0;i<s.length();i++) {
			if (s.charAt(i)=='B') {
				if (stack.isEmpty()==false) {
					stack.pop();
				}
			} else {
				stack.add(s.charAt(i));
			}
		}
		Stack<Character> result = new Stack<Character>();
		while (stack.isEmpty()==false) {
			Character c = stack.pop();
			result.add(c);
		}
		while (result.isEmpty()==false) {
			System.out.print(result.pop());
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Stack<Character> stack = new Stack<Character>();
		String s = sc.next();
		for(int i=0;i<s.length();i++) {
			if (s.charAt(i)=='B') {
				if (stack.isEmpty()==false) {
					stack.pop();
				}
			} else {
				stack.add(s.charAt(i));
			}
		}
		Stack<Character> result = new Stack<Character>();
		while (stack.isEmpty()==false) {
			Character c = stack.pop();
			result.add(c);
		}
		while (result.isEmpty()==false) {
			System.out.print(result.pop());
		}
	} main {
		Scanner sc = new Scanner(System.in);
		Stack<Character> stack = new Stack<Character>();
		String s = sc.next();
		for(int i=0;i<s.length();i++) {
			if (s.charAt(i)=='B') {
				if (stack.isEmpty()==false) {
					stack.pop();
				}
			} else {
				stack.add(s.charAt(i));
			}
		}
		Stack<Character> result = new Stack<Character>();
		while (stack.isEmpty()==false) {
			Character c = stack.pop();
			result.add(c);
		}
		while (result.isEmpty()==false) {
			System.out.print(result.pop());
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Stack<Character> stack = new Stack<Character>(); stack new Stack<Character>() String s = sc.next(); s sc.next() sc.next sc for(int i=0;i<s.length();i++) {
			if (s.charAt(i)=='B') {
				if (stack.isEmpty()==false) {
					stack.pop();
				}
			} else {
				stack.add(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 (stack.isEmpty()==false) {
					stack.pop();
				}
			} else {
				stack.add(s.charAt(i));
			}
		} {
			if (s.charAt(i)=='B') {
				if (stack.isEmpty()==false) {
					stack.pop();
				}
			} else {
				stack.add(s.charAt(i));
			}
		} if (s.charAt(i)=='B') {
				if (stack.isEmpty()==false) {
					stack.pop();
				}
			} else {
				stack.add(s.charAt(i));
			} s.charAt(i)=='B' s.charAt(i) s.charAt s i 'B' {
				if (stack.isEmpty()==false) {
					stack.pop();
				}
			} if (stack.isEmpty()==false) {
					stack.pop();
				} stack.isEmpty()==false stack.isEmpty() stack.isEmpty stack false {
					stack.pop();
				} stack.pop() stack.pop stack {
				stack.add(s.charAt(i));
			} stack.add(s.charAt(i)) stack.add stack s.charAt(i) s.charAt s i Stack<Character> result = new Stack<Character>(); result new Stack<Character>() while (stack.isEmpty()==false) {
			Character c = stack.pop();
			result.add(c);
		} stack.isEmpty()==false stack.isEmpty() stack.isEmpty stack false {
			Character c = stack.pop();
			result.add(c);
		} Character c = stack.pop(); c stack.pop() stack.pop stack result.add(c) result.add result c while (result.isEmpty()==false) {
			System.out.print(result.pop());
		} result.isEmpty()==false result.isEmpty() result.isEmpty result false {
			System.out.print(result.pop());
		} System.out.print(result.pop()) System.out.print System.out System System.out result.pop() result.pop result String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Stack<Character> stack = new Stack<Character>();
		String s = sc.next();
		for(int i=0;i<s.length();i++) {
			if (s.charAt(i)=='B') {
				if (stack.isEmpty()==false) {
					stack.pop();
				}
			} else {
				stack.add(s.charAt(i));
			}
		}
		Stack<Character> result = new Stack<Character>();
		while (stack.isEmpty()==false) {
			Character c = stack.pop();
			result.add(c);
		}
		while (result.isEmpty()==false) {
			System.out.print(result.pop());
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Stack<Character> stack = new Stack<Character>();
		String s = sc.next();
		for(int i=0;i<s.length();i++) {
			if (s.charAt(i)=='B') {
				if (stack.isEmpty()==false) {
					stack.pop();
				}
			} else {
				stack.add(s.charAt(i));
			}
		}
		Stack<Character> result = new Stack<Character>();
		while (stack.isEmpty()==false) {
			Character c = stack.pop();
			result.add(c);
		}
		while (result.isEmpty()==false) {
			System.out.print(result.pop());
		}
	}
} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Stack<Character> stack = new Stack<Character>();
		String s = sc.next();
		for(int i=0;i<s.length();i++) {
			if (s.charAt(i)=='B') {
				if (stack.isEmpty()==false) {
					stack.pop();
				}
			} else {
				stack.add(s.charAt(i));
			}
		}
		Stack<Character> result = new Stack<Character>();
		while (stack.isEmpty()==false) {
			Character c = stack.pop();
			result.add(c);
		}
		while (result.isEmpty()==false) {
			System.out.print(result.pop());
		}
	}
}