import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    String s = sc.next();

    sc.close();

    String[] S = s.split("");
    
    Deque<String> deque = new ArrayDeque<>();

    for (int i = 0; i < S.length; i++) {
      if (S[i].equals("0")) {
        deque.addLast("0");
      }
      if (S[i].equals("1")) {
        deque.addLast("1");
      }
      if (S[i].equals("B")) {
        if (0 < deque.size()) {
          deque.pollLast();
        }
      }
    }

    int l = deque.size();

    for (int i = 0; i < l; i++) {
      System.out.print(deque.pollFirst());
    }

    System.out.println("");

  }

} import java.util.*; util.* java public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    String s = sc.next();

    sc.close();

    String[] S = s.split("");
    
    Deque<String> deque = new ArrayDeque<>();

    for (int i = 0; i < S.length; i++) {
      if (S[i].equals("0")) {
        deque.addLast("0");
      }
      if (S[i].equals("1")) {
        deque.addLast("1");
      }
      if (S[i].equals("B")) {
        if (0 < deque.size()) {
          deque.pollLast();
        }
      }
    }

    int l = deque.size();

    for (int i = 0; i < l; i++) {
      System.out.print(deque.pollFirst());
    }

    System.out.println("");

  }

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

    Scanner sc = new Scanner(System.in);

    String s = sc.next();

    sc.close();

    String[] S = s.split("");
    
    Deque<String> deque = new ArrayDeque<>();

    for (int i = 0; i < S.length; i++) {
      if (S[i].equals("0")) {
        deque.addLast("0");
      }
      if (S[i].equals("1")) {
        deque.addLast("1");
      }
      if (S[i].equals("B")) {
        if (0 < deque.size()) {
          deque.pollLast();
        }
      }
    }

    int l = deque.size();

    for (int i = 0; i < l; i++) {
      System.out.print(deque.pollFirst());
    }

    System.out.println("");

  } main {

    Scanner sc = new Scanner(System.in);

    String s = sc.next();

    sc.close();

    String[] S = s.split("");
    
    Deque<String> deque = new ArrayDeque<>();

    for (int i = 0; i < S.length; i++) {
      if (S[i].equals("0")) {
        deque.addLast("0");
      }
      if (S[i].equals("1")) {
        deque.addLast("1");
      }
      if (S[i].equals("B")) {
        if (0 < deque.size()) {
          deque.pollLast();
        }
      }
    }

    int l = deque.size();

    for (int i = 0; i < l; i++) {
      System.out.print(deque.pollFirst());
    }

    System.out.println("");

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc sc.close() sc.close sc String[] S = s.split(""); S s.split("") s.split s "" Deque<String> deque = new ArrayDeque<>(); deque new ArrayDeque<>() for (int i = 0; i < S.length; i++) {
      if (S[i].equals("0")) {
        deque.addLast("0");
      }
      if (S[i].equals("1")) {
        deque.addLast("1");
      }
      if (S[i].equals("B")) {
        if (0 < deque.size()) {
          deque.pollLast();
        }
      }
    } int i = 0; int i = 0; i 0 i < S.length i S.length S S.length i++ i++ i {
      if (S[i].equals("0")) {
        deque.addLast("0");
      }
      if (S[i].equals("1")) {
        deque.addLast("1");
      }
      if (S[i].equals("B")) {
        if (0 < deque.size()) {
          deque.pollLast();
        }
      }
    } {
      if (S[i].equals("0")) {
        deque.addLast("0");
      }
      if (S[i].equals("1")) {
        deque.addLast("1");
      }
      if (S[i].equals("B")) {
        if (0 < deque.size()) {
          deque.pollLast();
        }
      }
    } if (S[i].equals("0")) {
        deque.addLast("0");
      } S[i].equals("0") S[i].equals S[i] S i "0" {
        deque.addLast("0");
      } deque.addLast("0") deque.addLast deque "0" if (S[i].equals("1")) {
        deque.addLast("1");
      } S[i].equals("1") S[i].equals S[i] S i "1" {
        deque.addLast("1");
      } deque.addLast("1") deque.addLast deque "1" if (S[i].equals("B")) {
        if (0 < deque.size()) {
          deque.pollLast();
        }
      } S[i].equals("B") S[i].equals S[i] S i "B" {
        if (0 < deque.size()) {
          deque.pollLast();
        }
      } if (0 < deque.size()) {
          deque.pollLast();
        } 0 < deque.size() 0 deque.size() deque.size deque {
          deque.pollLast();
        } deque.pollLast() deque.pollLast deque int l = deque.size(); l deque.size() deque.size deque for (int i = 0; i < l; i++) {
      System.out.print(deque.pollFirst());
    } int i = 0; int i = 0; i 0 i < l i l i++ i++ i {
      System.out.print(deque.pollFirst());
    } {
      System.out.print(deque.pollFirst());
    } System.out.print(deque.pollFirst()) System.out.print System.out System System.out deque.pollFirst() deque.pollFirst deque System.out.println("") System.out.println System.out System System.out "" String[] args args public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    String s = sc.next();

    sc.close();

    String[] S = s.split("");
    
    Deque<String> deque = new ArrayDeque<>();

    for (int i = 0; i < S.length; i++) {
      if (S[i].equals("0")) {
        deque.addLast("0");
      }
      if (S[i].equals("1")) {
        deque.addLast("1");
      }
      if (S[i].equals("B")) {
        if (0 < deque.size()) {
          deque.pollLast();
        }
      }
    }

    int l = deque.size();

    for (int i = 0; i < l; i++) {
      System.out.print(deque.pollFirst());
    }

    System.out.println("");

  }

} public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    String s = sc.next();

    sc.close();

    String[] S = s.split("");
    
    Deque<String> deque = new ArrayDeque<>();

    for (int i = 0; i < S.length; i++) {
      if (S[i].equals("0")) {
        deque.addLast("0");
      }
      if (S[i].equals("1")) {
        deque.addLast("1");
      }
      if (S[i].equals("B")) {
        if (0 < deque.size()) {
          deque.pollLast();
        }
      }
    }

    int l = deque.size();

    for (int i = 0; i < l; i++) {
      System.out.print(deque.pollFirst());
    }

    System.out.println("");

  }

} Main
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    String s = sc.next();

    sc.close();

    String[] S = s.split("");
    
    Deque<String> deque = new ArrayDeque<>();

    for (int i = 0; i < S.length; i++) {
      if (S[i].equals("0")) {
        deque.addLast("0");
      }
      if (S[i].equals("1")) {
        deque.addLast("1");
      }
      if (S[i].equals("B")) {
        if (0 < deque.size()) {
          deque.pollLast();
        }
      }
    }

    int l = deque.size();

    for (int i = 0; i < l; i++) {
      System.out.print(deque.pollFirst());
    }

    System.out.println("");

  }

}