import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int bufIdx = 0;
    char[] buf = new char[s.length()];
    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if (c == '0' || c == '1') {
        buf[bufIdx] = c;
        bufIdx++;
      } else if (c == 'B' && bufIdx != 0) {
        bufIdx--;
      }
    }
    
    for (int i = 0; i < bufIdx; i++) {
      System.out.print(buf[i]);
    }
    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();
    int bufIdx = 0;
    char[] buf = new char[s.length()];
    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if (c == '0' || c == '1') {
        buf[bufIdx] = c;
        bufIdx++;
      } else if (c == 'B' && bufIdx != 0) {
        bufIdx--;
      }
    }
    
    for (int i = 0; i < bufIdx; i++) {
      System.out.print(buf[i]);
    }
    System.out.println();
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int bufIdx = 0;
    char[] buf = new char[s.length()];
    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if (c == '0' || c == '1') {
        buf[bufIdx] = c;
        bufIdx++;
      } else if (c == 'B' && bufIdx != 0) {
        bufIdx--;
      }
    }
    
    for (int i = 0; i < bufIdx; i++) {
      System.out.print(buf[i]);
    }
    System.out.println();
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int bufIdx = 0;
    char[] buf = new char[s.length()];
    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if (c == '0' || c == '1') {
        buf[bufIdx] = c;
        bufIdx++;
      } else if (c == 'B' && bufIdx != 0) {
        bufIdx--;
      }
    }
    
    for (int i = 0; i < bufIdx; i++) {
      System.out.print(buf[i]);
    }
    System.out.println();
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int bufIdx = 0; bufIdx 0 char[] buf = new char[s.length()]; buf new char[s.length()] s.length() s.length s for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if (c == '0' || c == '1') {
        buf[bufIdx] = c;
        bufIdx++;
      } else if (c == 'B' && bufIdx != 0) {
        bufIdx--;
      }
    } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
      char c = s.charAt(i);
      if (c == '0' || c == '1') {
        buf[bufIdx] = c;
        bufIdx++;
      } else if (c == 'B' && bufIdx != 0) {
        bufIdx--;
      }
    } {
      char c = s.charAt(i);
      if (c == '0' || c == '1') {
        buf[bufIdx] = c;
        bufIdx++;
      } else if (c == 'B' && bufIdx != 0) {
        bufIdx--;
      }
    } char c = s.charAt(i); c s.charAt(i) s.charAt s i if (c == '0' || c == '1') {
        buf[bufIdx] = c;
        bufIdx++;
      } else if (c == 'B' && bufIdx != 0) {
        bufIdx--;
      } c == '0' || c == '1' c == '0' c '0' c == '1' c '1' {
        buf[bufIdx] = c;
        bufIdx++;
      } buf[bufIdx] = c buf[bufIdx] buf bufIdx c bufIdx++ bufIdx if (c == 'B' && bufIdx != 0) {
        bufIdx--;
      } c == 'B' && bufIdx != 0 c == 'B' c 'B' bufIdx != 0 bufIdx 0 {
        bufIdx--;
      } bufIdx-- bufIdx for (int i = 0; i < bufIdx; i++) {
      System.out.print(buf[i]);
    } int i = 0; int i = 0; i 0 i < bufIdx i bufIdx i++ i++ i {
      System.out.print(buf[i]);
    } {
      System.out.print(buf[i]);
    } System.out.print(buf[i]) System.out.print System.out System System.out buf[i] buf i 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();
    int bufIdx = 0;
    char[] buf = new char[s.length()];
    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if (c == '0' || c == '1') {
        buf[bufIdx] = c;
        bufIdx++;
      } else if (c == 'B' && bufIdx != 0) {
        bufIdx--;
      }
    }
    
    for (int i = 0; i < bufIdx; i++) {
      System.out.print(buf[i]);
    }
    System.out.println();
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int bufIdx = 0;
    char[] buf = new char[s.length()];
    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if (c == '0' || c == '1') {
        buf[bufIdx] = c;
        bufIdx++;
      } else if (c == 'B' && bufIdx != 0) {
        bufIdx--;
      }
    }
    
    for (int i = 0; i < bufIdx; i++) {
      System.out.print(buf[i]);
    }
    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();
    int bufIdx = 0;
    char[] buf = new char[s.length()];
    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if (c == '0' || c == '1') {
        buf[bufIdx] = c;
        bufIdx++;
      } else if (c == 'B' && bufIdx != 0) {
        bufIdx--;
      }
    }
    
    for (int i = 0; i < bufIdx; i++) {
      System.out.print(buf[i]);
    }
    System.out.println();
  }
}