import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String line = scanner.nextLine();
    Stack<Character> items = new Stack<>();
    for (char letter : line.toCharArray()) {
      if (Character.isDigit(letter)) {
        items.push(letter);
      } else if (letter == 'B' && !items.isEmpty()) {
         items.pop();
      }
    }
    
    StringBuilder builder = new StringBuilder();
    for (char letter : items) {
      builder.append(letter); 
    }
    
    System.out.println(builder);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String line = scanner.nextLine();
    Stack<Character> items = new Stack<>();
    for (char letter : line.toCharArray()) {
      if (Character.isDigit(letter)) {
        items.push(letter);
      } else if (letter == 'B' && !items.isEmpty()) {
         items.pop();
      }
    }
    
    StringBuilder builder = new StringBuilder();
    for (char letter : items) {
      builder.append(letter); 
    }
    
    System.out.println(builder);
  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String line = scanner.nextLine();
    Stack<Character> items = new Stack<>();
    for (char letter : line.toCharArray()) {
      if (Character.isDigit(letter)) {
        items.push(letter);
      } else if (letter == 'B' && !items.isEmpty()) {
         items.pop();
      }
    }
    
    StringBuilder builder = new StringBuilder();
    for (char letter : items) {
      builder.append(letter); 
    }
    
    System.out.println(builder);
  } main {
    Scanner scanner = new Scanner(System.in);
    String line = scanner.nextLine();
    Stack<Character> items = new Stack<>();
    for (char letter : line.toCharArray()) {
      if (Character.isDigit(letter)) {
        items.push(letter);
      } else if (letter == 'B' && !items.isEmpty()) {
         items.pop();
      }
    }
    
    StringBuilder builder = new StringBuilder();
    for (char letter : items) {
      builder.append(letter); 
    }
    
    System.out.println(builder);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String line = scanner.nextLine(); line scanner.nextLine() scanner.nextLine scanner Stack<Character> items = new Stack<>(); items new Stack<>() for (char letter : line.toCharArray()) {
      if (Character.isDigit(letter)) {
        items.push(letter);
      } else if (letter == 'B' && !items.isEmpty()) {
         items.pop();
      }
    } char letter line.toCharArray() line.toCharArray line {
      if (Character.isDigit(letter)) {
        items.push(letter);
      } else if (letter == 'B' && !items.isEmpty()) {
         items.pop();
      }
    } {
      if (Character.isDigit(letter)) {
        items.push(letter);
      } else if (letter == 'B' && !items.isEmpty()) {
         items.pop();
      }
    } if (Character.isDigit(letter)) {
        items.push(letter);
      } else if (letter == 'B' && !items.isEmpty()) {
         items.pop();
      } Character.isDigit(letter) Character.isDigit Character letter {
        items.push(letter);
      } items.push(letter) items.push items letter if (letter == 'B' && !items.isEmpty()) {
         items.pop();
      } letter == 'B' && !items.isEmpty() letter == 'B' letter 'B' !items.isEmpty() items.isEmpty() items.isEmpty items {
         items.pop();
      } items.pop() items.pop items StringBuilder builder = new StringBuilder(); builder new StringBuilder() for (char letter : items) {
      builder.append(letter); 
    } char letter items {
      builder.append(letter); 
    } {
      builder.append(letter); 
    } builder.append(letter) builder.append builder letter System.out.println(builder) System.out.println System.out System System.out builder String[] args args public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String line = scanner.nextLine();
    Stack<Character> items = new Stack<>();
    for (char letter : line.toCharArray()) {
      if (Character.isDigit(letter)) {
        items.push(letter);
      } else if (letter == 'B' && !items.isEmpty()) {
         items.pop();
      }
    }
    
    StringBuilder builder = new StringBuilder();
    for (char letter : items) {
      builder.append(letter); 
    }
    
    System.out.println(builder);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String line = scanner.nextLine();
    Stack<Character> items = new Stack<>();
    for (char letter : line.toCharArray()) {
      if (Character.isDigit(letter)) {
        items.push(letter);
      } else if (letter == 'B' && !items.isEmpty()) {
         items.pop();
      }
    }
    
    StringBuilder builder = new StringBuilder();
    for (char letter : items) {
      builder.append(letter); 
    }
    
    System.out.println(builder);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String line = scanner.nextLine();
    Stack<Character> items = new Stack<>();
    for (char letter : line.toCharArray()) {
      if (Character.isDigit(letter)) {
        items.push(letter);
      } else if (letter == 'B' && !items.isEmpty()) {
         items.pop();
      }
    }
    
    StringBuilder builder = new StringBuilder();
    for (char letter : items) {
      builder.append(letter); 
    }
    
    System.out.println(builder);
  }
}