import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);

    final String s = scanner.nextLine();

    StringBuilder o = new StringBuilder();
    for (char c: s.toCharArray()) {
      switch (c) {
        case '0':
        case '1':
          o.append(c);
          break;
        case 'B':
          if (o.length() > 0) {
            o.deleteCharAt(o.length() - 1);
          }
      }
    }

    System.out.println(o.toString());
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);

    final String s = scanner.nextLine();

    StringBuilder o = new StringBuilder();
    for (char c: s.toCharArray()) {
      switch (c) {
        case '0':
        case '1':
          o.append(c);
          break;
        case 'B':
          if (o.length() > 0) {
            o.deleteCharAt(o.length() - 1);
          }
      }
    }

    System.out.println(o.toString());
  }
} Main public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);

    final String s = scanner.nextLine();

    StringBuilder o = new StringBuilder();
    for (char c: s.toCharArray()) {
      switch (c) {
        case '0':
        case '1':
          o.append(c);
          break;
        case 'B':
          if (o.length() > 0) {
            o.deleteCharAt(o.length() - 1);
          }
      }
    }

    System.out.println(o.toString());
  } main {
    final Scanner scanner = new Scanner(System.in);

    final String s = scanner.nextLine();

    StringBuilder o = new StringBuilder();
    for (char c: s.toCharArray()) {
      switch (c) {
        case '0':
        case '1':
          o.append(c);
          break;
        case 'B':
          if (o.length() > 0) {
            o.deleteCharAt(o.length() - 1);
          }
      }
    }

    System.out.println(o.toString());
  } final Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) final String s = scanner.nextLine(); s scanner.nextLine() scanner.nextLine scanner StringBuilder o = new StringBuilder(); o new StringBuilder() for (char c: s.toCharArray()) {
      switch (c) {
        case '0':
        case '1':
          o.append(c);
          break;
        case 'B':
          if (o.length() > 0) {
            o.deleteCharAt(o.length() - 1);
          }
      }
    } char c s.toCharArray() s.toCharArray s {
      switch (c) {
        case '0':
        case '1':
          o.append(c);
          break;
        case 'B':
          if (o.length() > 0) {
            o.deleteCharAt(o.length() - 1);
          }
      }
    } {
      switch (c) {
        case '0':
        case '1':
          o.append(c);
          break;
        case 'B':
          if (o.length() > 0) {
            o.deleteCharAt(o.length() - 1);
          }
      }
    } switch (c) {
        case '0':
        case '1':
          o.append(c);
          break;
        case 'B':
          if (o.length() > 0) {
            o.deleteCharAt(o.length() - 1);
          }
      } c case '0': '0' case '0': case '1': '1' case '1': o.append(c) o.append o c break; case 'B': 'B' case 'B': if (o.length() > 0) {
            o.deleteCharAt(o.length() - 1);
          } o.length() > 0 o.length() o.length o 0 {
            o.deleteCharAt(o.length() - 1);
          } o.deleteCharAt(o.length() - 1) o.deleteCharAt o o.length() - 1 o.length() o.length o 1 System.out.println(o.toString()) System.out.println System.out System System.out o.toString() o.toString o String[] args args public class Main {
  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);

    final String s = scanner.nextLine();

    StringBuilder o = new StringBuilder();
    for (char c: s.toCharArray()) {
      switch (c) {
        case '0':
        case '1':
          o.append(c);
          break;
        case 'B':
          if (o.length() > 0) {
            o.deleteCharAt(o.length() - 1);
          }
      }
    }

    System.out.println(o.toString());
  }
} public class Main {
  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);

    final String s = scanner.nextLine();

    StringBuilder o = new StringBuilder();
    for (char c: s.toCharArray()) {
      switch (c) {
        case '0':
        case '1':
          o.append(c);
          break;
        case 'B':
          if (o.length() > 0) {
            o.deleteCharAt(o.length() - 1);
          }
      }
    }

    System.out.println(o.toString());
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);

    final String s = scanner.nextLine();

    StringBuilder o = new StringBuilder();
    for (char c: s.toCharArray()) {
      switch (c) {
        case '0':
        case '1':
          o.append(c);
          break;
        case 'B':
          if (o.length() > 0) {
            o.deleteCharAt(o.length() - 1);
          }
      }
    }

    System.out.println(o.toString());
  }
}