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("");
  }
} import java.util.*; util.* java 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("");
  }
} Main int n; n char s[]; s Deque<Integer> deq = new ArrayDeque<Integer>(); deq new ArrayDeque<Integer>() int ans; ans public static void main(String[] args) {
    Main main = new Main();
    main.solve();
    main.show();
  } main {
    Main main = new Main();
    main.solve();
    main.show();
  } Main main = new Main(); main new Main() main.solve() main.solve main main.show() main.show main String[] args args public Main() {
    Scanner sc = new Scanner(System.in);
    try {
      s = sc.next().toCharArray();
      n = s.length;
    } finally {
      sc.close();
    }
  } Main {
    Scanner sc = new Scanner(System.in);
    try {
      s = sc.next().toCharArray();
      n = s.length;
    } finally {
      sc.close();
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) try {
      s = sc.next().toCharArray();
      n = s.length;
    } finally {
      sc.close();
    } {
      sc.close();
    } sc.close() sc.close sc {
      s = sc.next().toCharArray();
      n = s.length;
    } s = sc.next().toCharArray() s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc n = s.length n s.length s s.length 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();
    }
  } 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();
    }
  } 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();
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      // System.out.println(s[i]);
      if (s[i] == '0') append(0);
      if (s[i] == '1') append(1);
      if (s[i] == 'B') delete();
    } {
      // System.out.println(s[i]);
      if (s[i] == '0') append(0);
      if (s[i] == '1') append(1);
      if (s[i] == 'B') delete();
    } if (s[i] == '0') append(0); s[i] == '0' s[i] s i '0' append(0) append 0 if (s[i] == '1') append(1); s[i] == '1' s[i] s i '1' append(1) append 1 if (s[i] == 'B') delete(); s[i] == 'B' s[i] s i 'B' delete() delete void append(int a) {
    deq.addLast(a);
  } append {
    deq.addLast(a);
  } deq.addLast(a) deq.addLast deq a int a a void delete() {
    if (deq.size() > 0) deq.removeLast();
  } delete {
    if (deq.size() > 0) deq.removeLast();
  } if (deq.size() > 0) deq.removeLast(); deq.size() > 0 deq.size() deq.size deq 0 deq.removeLast() deq.removeLast deq void show() {
    while (deq.size() > 0) {
      ans = deq.pollFirst();
      System.out.print(ans);
    }
    System.out.println("");
  } show {
    while (deq.size() > 0) {
      ans = deq.pollFirst();
      System.out.print(ans);
    }
    System.out.println("");
  } while (deq.size() > 0) {
      ans = deq.pollFirst();
      System.out.print(ans);
    } deq.size() > 0 deq.size() deq.size deq 0 {
      ans = deq.pollFirst();
      System.out.print(ans);
    } ans = deq.pollFirst() ans deq.pollFirst() deq.pollFirst deq System.out.print(ans) System.out.print System.out System System.out ans System.out.println("") System.out.println System.out System System.out "" 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("");
  }
} 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("");
  }
} Main
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("");
  }
}
