import java.util.Scanner;

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

    char[] s = scanner.next().toCharArray();
    StringBuilder sb = new StringBuilder();
    for (char ch : s) {
      if (ch == 'B') {
        if (sb.length() > 0) sb.setLength(sb.length() - 1);
      } else {
        sb.append(ch);
      }
    }
    System.out.println(sb.toString());
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    char[] s = scanner.next().toCharArray();
    StringBuilder sb = new StringBuilder();
    for (char ch : s) {
      if (ch == 'B') {
        if (sb.length() > 0) sb.setLength(sb.length() - 1);
      } else {
        sb.append(ch);
      }
    }
    System.out.println(sb.toString());
  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    char[] s = scanner.next().toCharArray();
    StringBuilder sb = new StringBuilder();
    for (char ch : s) {
      if (ch == 'B') {
        if (sb.length() > 0) sb.setLength(sb.length() - 1);
      } else {
        sb.append(ch);
      }
    }
    System.out.println(sb.toString());
  } main {
    Scanner scanner = new Scanner(System.in);

    char[] s = scanner.next().toCharArray();
    StringBuilder sb = new StringBuilder();
    for (char ch : s) {
      if (ch == 'B') {
        if (sb.length() > 0) sb.setLength(sb.length() - 1);
      } else {
        sb.append(ch);
      }
    }
    System.out.println(sb.toString());
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) char[] s = scanner.next().toCharArray(); s scanner.next().toCharArray() scanner.next().toCharArray scanner.next() scanner.next scanner StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (char ch : s) {
      if (ch == 'B') {
        if (sb.length() > 0) sb.setLength(sb.length() - 1);
      } else {
        sb.append(ch);
      }
    } char ch s {
      if (ch == 'B') {
        if (sb.length() > 0) sb.setLength(sb.length() - 1);
      } else {
        sb.append(ch);
      }
    } {
      if (ch == 'B') {
        if (sb.length() > 0) sb.setLength(sb.length() - 1);
      } else {
        sb.append(ch);
      }
    } if (ch == 'B') {
        if (sb.length() > 0) sb.setLength(sb.length() - 1);
      } else {
        sb.append(ch);
      } ch == 'B' ch 'B' {
        if (sb.length() > 0) sb.setLength(sb.length() - 1);
      } if (sb.length() > 0) sb.setLength(sb.length() - 1); sb.length() > 0 sb.length() sb.length sb 0 sb.setLength(sb.length() - 1) sb.setLength sb sb.length() - 1 sb.length() sb.length sb 1 {
        sb.append(ch);
      } sb.append(ch) sb.append sb ch System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    char[] s = scanner.next().toCharArray();
    StringBuilder sb = new StringBuilder();
    for (char ch : s) {
      if (ch == 'B') {
        if (sb.length() > 0) sb.setLength(sb.length() - 1);
      } else {
        sb.append(ch);
      }
    }
    System.out.println(sb.toString());
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    char[] s = scanner.next().toCharArray();
    StringBuilder sb = new StringBuilder();
    for (char ch : s) {
      if (ch == 'B') {
        if (sb.length() > 0) sb.setLength(sb.length() - 1);
      } else {
        sb.append(ch);
      }
    }
    System.out.println(sb.toString());
  }
} Main
import java.util.Scanner;

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

    char[] s = scanner.next().toCharArray();
    StringBuilder sb = new StringBuilder();
    for (char ch : s) {
      if (ch == 'B') {
        if (sb.length() > 0) sb.setLength(sb.length() - 1);
      } else {
        sb.append(ch);
      }
    }
    System.out.println(sb.toString());
  }
}
