import java.util.*;

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

        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            switch (s.charAt(i)) {
                case '0':
                    builder.append("0");
                    break;
                case '1':
                    builder.append("1");
                    break;
                case 'B':
                    if (builder.length() > 0) {
                        builder.deleteCharAt(builder.length() - 1);
                    }
                    break;
            }
        }
        System.out.println(builder.toString());
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();

        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            switch (s.charAt(i)) {
                case '0':
                    builder.append("0");
                    break;
                case '1':
                    builder.append("1");
                    break;
                case 'B':
                    if (builder.length() > 0) {
                        builder.deleteCharAt(builder.length() - 1);
                    }
                    break;
            }
        }
        System.out.println(builder.toString());
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();

        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            switch (s.charAt(i)) {
                case '0':
                    builder.append("0");
                    break;
                case '1':
                    builder.append("1");
                    break;
                case 'B':
                    if (builder.length() > 0) {
                        builder.deleteCharAt(builder.length() - 1);
                    }
                    break;
            }
        }
        System.out.println(builder.toString());
    } main {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();

        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            switch (s.charAt(i)) {
                case '0':
                    builder.append("0");
                    break;
                case '1':
                    builder.append("1");
                    break;
                case 'B':
                    if (builder.length() > 0) {
                        builder.deleteCharAt(builder.length() - 1);
                    }
                    break;
            }
        }
        System.out.println(builder.toString());
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.nextLine(); s scanner.nextLine() scanner.nextLine scanner StringBuilder builder = new StringBuilder(); builder new StringBuilder() for (int i = 0; i < s.length(); i++) {
            switch (s.charAt(i)) {
                case '0':
                    builder.append("0");
                    break;
                case '1':
                    builder.append("1");
                    break;
                case 'B':
                    if (builder.length() > 0) {
                        builder.deleteCharAt(builder.length() - 1);
                    }
                    break;
            }
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            switch (s.charAt(i)) {
                case '0':
                    builder.append("0");
                    break;
                case '1':
                    builder.append("1");
                    break;
                case 'B':
                    if (builder.length() > 0) {
                        builder.deleteCharAt(builder.length() - 1);
                    }
                    break;
            }
        } {
            switch (s.charAt(i)) {
                case '0':
                    builder.append("0");
                    break;
                case '1':
                    builder.append("1");
                    break;
                case 'B':
                    if (builder.length() > 0) {
                        builder.deleteCharAt(builder.length() - 1);
                    }
                    break;
            }
        } switch (s.charAt(i)) {
                case '0':
                    builder.append("0");
                    break;
                case '1':
                    builder.append("1");
                    break;
                case 'B':
                    if (builder.length() > 0) {
                        builder.deleteCharAt(builder.length() - 1);
                    }
                    break;
            } s.charAt(i) s.charAt s i case '0': '0' case '0': builder.append("0") builder.append builder "0" break; case '1': '1' case '1': builder.append("1") builder.append builder "1" break; case 'B': 'B' case 'B': if (builder.length() > 0) {
                        builder.deleteCharAt(builder.length() - 1);
                    } builder.length() > 0 builder.length() builder.length builder 0 {
                        builder.deleteCharAt(builder.length() - 1);
                    } builder.deleteCharAt(builder.length() - 1) builder.deleteCharAt builder builder.length() - 1 builder.length() builder.length builder 1 break; System.out.println(builder.toString()) System.out.println System.out System System.out builder.toString() builder.toString builder String[] args args
import java.util.*;

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

        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            switch (s.charAt(i)) {
                case '0':
                    builder.append("0");
                    break;
                case '1':
                    builder.append("1");
                    break;
                case 'B':
                    if (builder.length() > 0) {
                        builder.deleteCharAt(builder.length() - 1);
                    }
                    break;
            }
        }
        System.out.println(builder.toString());
    }
}
