import java.util.Scanner;
import java.util.LinkedList;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
  	LinkedList<Character> stack = new LinkedList<>();
    String s = sc.next();
    String res = "";
    
    for (int i = 0; i < s.length(); i++) {
    	if (s.charAt(i) == 'B') {
          if (!stack.isEmpty()) {
          	stack.pop();
          }
        } else {
        	stack.push(s.charAt(i));
        }
    }
                       
    while (!stack.isEmpty()) {
      res = stack.pop() + res;
    }
                       
    System.out.println(res);
  }
} import java.util.Scanner; Scanner java.util import java.util.LinkedList; LinkedList java.util public class Main {

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

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
  	LinkedList<Character> stack = new LinkedList<>();
    String s = sc.next();
    String res = "";
    
    for (int i = 0; i < s.length(); i++) {
    	if (s.charAt(i) == 'B') {
          if (!stack.isEmpty()) {
          	stack.pop();
          }
        } else {
        	stack.push(s.charAt(i));
        }
    }
                       
    while (!stack.isEmpty()) {
      res = stack.pop() + res;
    }
                       
    System.out.println(res);
  }
} public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
  	LinkedList<Character> stack = new LinkedList<>();
    String s = sc.next();
    String res = "";
    
    for (int i = 0; i < s.length(); i++) {
    	if (s.charAt(i) == 'B') {
          if (!stack.isEmpty()) {
          	stack.pop();
          }
        } else {
        	stack.push(s.charAt(i));
        }
    }
                       
    while (!stack.isEmpty()) {
      res = stack.pop() + res;
    }
                       
    System.out.println(res);
  }
} Main
import java.util.Scanner;
import java.util.LinkedList;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
  	LinkedList<Character> stack = new LinkedList<>();
    String s = sc.next();
    String res = "";
    
    for (int i = 0; i < s.length(); i++) {
    	if (s.charAt(i) == 'B') {
          if (!stack.isEmpty()) {
          	stack.pop();
          }
        } else {
        	stack.push(s.charAt(i));
        }
    }
                       
    while (!stack.isEmpty()) {
      res = stack.pop() + res;
    }
                       
    System.out.println(res);
  }
}
