import java.util.Scanner;

public class Main {

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

        StringBuilder sb = new StringBuilder();
        for (char c : S.toCharArray()) {
            switch (c) {
                case '0':
                case '1':
                    sb.append(c);
                    break;
                case 'B':
                    if (sb.length() > 0) {
                        sb.deleteCharAt(sb.length() - 1);
                    }
                    break;
                default:
                    throw new IllegalStateException();
            }
        }

        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);
        String S = scanner.next();
        scanner.close();

        StringBuilder sb = new StringBuilder();
        for (char c : S.toCharArray()) {
            switch (c) {
                case '0':
                case '1':
                    sb.append(c);
                    break;
                case 'B':
                    if (sb.length() > 0) {
                        sb.deleteCharAt(sb.length() - 1);
                    }
                    break;
                default:
                    throw new IllegalStateException();
            }
        }

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

        StringBuilder sb = new StringBuilder();
        for (char c : S.toCharArray()) {
            switch (c) {
                case '0':
                case '1':
                    sb.append(c);
                    break;
                case 'B':
                    if (sb.length() > 0) {
                        sb.deleteCharAt(sb.length() - 1);
                    }
                    break;
                default:
                    throw new IllegalStateException();
            }
        }

        System.out.println(sb.toString());
    } main {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        scanner.close();

        StringBuilder sb = new StringBuilder();
        for (char c : S.toCharArray()) {
            switch (c) {
                case '0':
                case '1':
                    sb.append(c);
                    break;
                case 'B':
                    if (sb.length() > 0) {
                        sb.deleteCharAt(sb.length() - 1);
                    }
                    break;
                default:
                    throw new IllegalStateException();
            }
        }

        System.out.println(sb.toString());
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner scanner.close() scanner.close scanner StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (char c : S.toCharArray()) {
            switch (c) {
                case '0':
                case '1':
                    sb.append(c);
                    break;
                case 'B':
                    if (sb.length() > 0) {
                        sb.deleteCharAt(sb.length() - 1);
                    }
                    break;
                default:
                    throw new IllegalStateException();
            }
        } char c S.toCharArray() S.toCharArray S {
            switch (c) {
                case '0':
                case '1':
                    sb.append(c);
                    break;
                case 'B':
                    if (sb.length() > 0) {
                        sb.deleteCharAt(sb.length() - 1);
                    }
                    break;
                default:
                    throw new IllegalStateException();
            }
        } {
            switch (c) {
                case '0':
                case '1':
                    sb.append(c);
                    break;
                case 'B':
                    if (sb.length() > 0) {
                        sb.deleteCharAt(sb.length() - 1);
                    }
                    break;
                default:
                    throw new IllegalStateException();
            }
        } switch (c) {
                case '0':
                case '1':
                    sb.append(c);
                    break;
                case 'B':
                    if (sb.length() > 0) {
                        sb.deleteCharAt(sb.length() - 1);
                    }
                    break;
                default:
                    throw new IllegalStateException();
            } c case '0': '0' case '0': case '1': '1' case '1': sb.append(c) sb.append sb c break; case 'B': 'B' case 'B': 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 break; default: default: throw new IllegalStateException(); new IllegalStateException() 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);
        String S = scanner.next();
        scanner.close();

        StringBuilder sb = new StringBuilder();
        for (char c : S.toCharArray()) {
            switch (c) {
                case '0':
                case '1':
                    sb.append(c);
                    break;
                case 'B':
                    if (sb.length() > 0) {
                        sb.deleteCharAt(sb.length() - 1);
                    }
                    break;
                default:
                    throw new IllegalStateException();
            }
        }

        System.out.println(sb.toString());
    }
} public class Main {

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

        StringBuilder sb = new StringBuilder();
        for (char c : S.toCharArray()) {
            switch (c) {
                case '0':
                case '1':
                    sb.append(c);
                    break;
                case 'B':
                    if (sb.length() > 0) {
                        sb.deleteCharAt(sb.length() - 1);
                    }
                    break;
                default:
                    throw new IllegalStateException();
            }
        }

        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);
        String S = scanner.next();
        scanner.close();

        StringBuilder sb = new StringBuilder();
        for (char c : S.toCharArray()) {
            switch (c) {
                case '0':
                case '1':
                    sb.append(c);
                    break;
                case 'B':
                    if (sb.length() > 0) {
                        sb.deleteCharAt(sb.length() - 1);
                    }
                    break;
                default:
                    throw new IllegalStateException();
            }
        }

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