import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();

    char[] array = S.toCharArray();
    System.out.println(resolve(array));
  }

  private static String resolve(char[] array) {
    StringBuilder sb = new StringBuilder();
    for (char c : array) {
      if (c != 'B') {
        sb.append(c);
      } else if (sb.length() != 0) {
        sb.deleteCharAt(sb.length() - 1);
      }
    }

    return sb.toString();
  }
} import java.util.Scanner; Scanner java.util public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();

    char[] array = S.toCharArray();
    System.out.println(resolve(array));
  }

  private static String resolve(char[] array) {
    StringBuilder sb = new StringBuilder();
    for (char c : array) {
      if (c != 'B') {
        sb.append(c);
      } else if (sb.length() != 0) {
        sb.deleteCharAt(sb.length() - 1);
      }
    }

    return sb.toString();
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();

    char[] array = S.toCharArray();
    System.out.println(resolve(array));
  } main {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();

    char[] array = S.toCharArray();
    System.out.println(resolve(array));
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc char[] array = S.toCharArray(); array S.toCharArray() S.toCharArray S System.out.println(resolve(array)) System.out.println System.out System System.out resolve(array) resolve array String[] args args private static String resolve(char[] array) {
    StringBuilder sb = new StringBuilder();
    for (char c : array) {
      if (c != 'B') {
        sb.append(c);
      } else if (sb.length() != 0) {
        sb.deleteCharAt(sb.length() - 1);
      }
    }

    return sb.toString();
  } resolve {
    StringBuilder sb = new StringBuilder();
    for (char c : array) {
      if (c != 'B') {
        sb.append(c);
      } else if (sb.length() != 0) {
        sb.deleteCharAt(sb.length() - 1);
      }
    }

    return sb.toString();
  } StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (char c : array) {
      if (c != 'B') {
        sb.append(c);
      } else if (sb.length() != 0) {
        sb.deleteCharAt(sb.length() - 1);
      }
    } char c array {
      if (c != 'B') {
        sb.append(c);
      } else if (sb.length() != 0) {
        sb.deleteCharAt(sb.length() - 1);
      }
    } {
      if (c != 'B') {
        sb.append(c);
      } else if (sb.length() != 0) {
        sb.deleteCharAt(sb.length() - 1);
      }
    } if (c != 'B') {
        sb.append(c);
      } else if (sb.length() != 0) {
        sb.deleteCharAt(sb.length() - 1);
      } c != 'B' c 'B' {
        sb.append(c);
      } sb.append(c) sb.append sb c if (sb.length() != 0) {
        sb.deleteCharAt(sb.length() - 1);
      } sb.length() != 0 sb.length() sb.length sb 0 {
        sb.deleteCharAt(sb.length() - 1);
      } sb.deleteCharAt(sb.length() - 1) sb.deleteCharAt sb sb.length() - 1 sb.length() sb.length sb 1 return sb.toString(); sb.toString() sb.toString sb char[] array array public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();

    char[] array = S.toCharArray();
    System.out.println(resolve(array));
  }

  private static String resolve(char[] array) {
    StringBuilder sb = new StringBuilder();
    for (char c : array) {
      if (c != 'B') {
        sb.append(c);
      } else if (sb.length() != 0) {
        sb.deleteCharAt(sb.length() - 1);
      }
    }

    return sb.toString();
  }
} public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();

    char[] array = S.toCharArray();
    System.out.println(resolve(array));
  }

  private static String resolve(char[] array) {
    StringBuilder sb = new StringBuilder();
    for (char c : array) {
      if (c != 'B') {
        sb.append(c);
      } else if (sb.length() != 0) {
        sb.deleteCharAt(sb.length() - 1);
      }
    }

    return sb.toString();
  }
} Main
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();

    char[] array = S.toCharArray();
    System.out.println(resolve(array));
  }

  private static String resolve(char[] array) {
    StringBuilder sb = new StringBuilder();
    for (char c : array) {
      if (c != 'B') {
        sb.append(c);
      } else if (sb.length() != 0) {
        sb.deleteCharAt(sb.length() - 1);
      }
    }

    return sb.toString();
  }
}
