import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        // 主処理
        String result = s;
        while (result.contains("B")) {
            result = result.replaceAll("[01]B", "");
            result = result.replaceAll("^B", "");
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
} import java.util.*; util.* java public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        // 主処理
        String result = s;
        while (result.contains("B")) {
            result = result.replaceAll("[01]B", "");
            result = result.replaceAll("^B", "");
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
} Main public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        // 主処理
        String result = s;
        while (result.contains("B")) {
            result = result.replaceAll("[01]B", "");
            result = result.replaceAll("^B", "");
        }

        // 出力
        System.out.println(result);
        sc.close();
    } main {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        // 主処理
        String result = s;
        while (result.contains("B")) {
            result = result.replaceAll("[01]B", "");
            result = result.replaceAll("^B", "");
        }

        // 出力
        System.out.println(result);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String result = s; result s while (result.contains("B")) {
            result = result.replaceAll("[01]B", "");
            result = result.replaceAll("^B", "");
        } result.contains("B") result.contains result "B" {
            result = result.replaceAll("[01]B", "");
            result = result.replaceAll("^B", "");
        } result = result.replaceAll("[01]B", "") result result.replaceAll("[01]B", "") result.replaceAll result "[01]B" "" result = result.replaceAll("^B", "") result result.replaceAll("^B", "") result.replaceAll result "^B" "" System.out.println(result) System.out.println System.out System System.out result sc.close() sc.close sc String args[] args public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        // 主処理
        String result = s;
        while (result.contains("B")) {
            result = result.replaceAll("[01]B", "");
            result = result.replaceAll("^B", "");
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
} public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        // 主処理
        String result = s;
        while (result.contains("B")) {
            result = result.replaceAll("[01]B", "");
            result = result.replaceAll("^B", "");
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
} Main
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        // 主処理
        String result = s;
        while (result.contains("B")) {
            result = result.replaceAll("[01]B", "");
            result = result.replaceAll("^B", "");
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
}
