import java.util.*;

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

  int n;
  char s[];
  Deque<Integer> deq = new ArrayDeque<Integer>();
  int ans;

  public Main() {
    Scanner sc = new Scanner(System.in);
    try {
      s = sc.next().toCharArray();
      n = s.length;
    } finally {
      sc.close();
    }
  }
  
  void solve() {
    for (int i = 0; i < n; i++) {
      // System.out.println(s[i]);
      if (s[i] == '0') append(0);
      if (s[i] == '1') append(1);
      if (s[i] == 'B') delete();
    }
  }

  void append(int a) {
    deq.addLast(a);
  }

  void delete() {
    if (deq.size() > 0) deq.removeLast();
  }

  void show() {
    while (deq.size() > 0) {
      ans = deq.pollFirst();
      System.out.print(ans);
    }
    System.out.println("");
  }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz