import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {

    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String ans = "";
        for (int index = 0; index < s.length; index++) {
            switch (s[index]) {
            case '0':
                ans += "0";
                break;
            case '1':
                ans += "1";
                break;
            case 'B':
                ans = ans.substring(0, Math.max(0,ans.length() - 1));
                break;
            }
        }
        System.out.println(ans);
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util import java.util.HashMap; HashMap java.util import java.util.HashSet; HashSet java.util import java.util.Iterator; Iterator java.util import java.util.Map.Entry; Entry java.util.Map import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util class Main {

    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String ans = "";
        for (int index = 0; index < s.length; index++) {
            switch (s[index]) {
            case '0':
                ans += "0";
                break;
            case '1':
                ans += "1";
                break;
            case 'B':
                ans = ans.substring(0, Math.max(0,ans.length() - 1));
                break;
            }
        }
        System.out.println(ans);
    }
} Main static final int MOD = 1000000007; MOD 1000000007 static final int INF = 1 << 30; INF 1 << 30 1 30 public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String ans = "";
        for (int index = 0; index < s.length; index++) {
            switch (s[index]) {
            case '0':
                ans += "0";
                break;
            case '1':
                ans += "1";
                break;
            case 'B':
                ans = ans.substring(0, Math.max(0,ans.length() - 1));
                break;
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String ans = "";
        for (int index = 0; index < s.length; index++) {
            switch (s[index]) {
            case '0':
                ans += "0";
                break;
            case '1':
                ans += "1";
                break;
            case 'B':
                ans = ans.substring(0, Math.max(0,ans.length() - 1));
                break;
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc String ans = ""; ans "" for (int index = 0; index < s.length; index++) {
            switch (s[index]) {
            case '0':
                ans += "0";
                break;
            case '1':
                ans += "1";
                break;
            case 'B':
                ans = ans.substring(0, Math.max(0,ans.length() - 1));
                break;
            }
        } int index = 0; int index = 0; index 0 index < s.length index s.length s s.length index++ index++ index {
            switch (s[index]) {
            case '0':
                ans += "0";
                break;
            case '1':
                ans += "1";
                break;
            case 'B':
                ans = ans.substring(0, Math.max(0,ans.length() - 1));
                break;
            }
        } {
            switch (s[index]) {
            case '0':
                ans += "0";
                break;
            case '1':
                ans += "1";
                break;
            case 'B':
                ans = ans.substring(0, Math.max(0,ans.length() - 1));
                break;
            }
        } switch (s[index]) {
            case '0':
                ans += "0";
                break;
            case '1':
                ans += "1";
                break;
            case 'B':
                ans = ans.substring(0, Math.max(0,ans.length() - 1));
                break;
            } s[index] s index case '0': '0' case '0': ans += "0" ans "0" break; case '1': '1' case '1': ans += "1" ans "1" break; case 'B': 'B' case 'B': ans = ans.substring(0, Math.max(0,ans.length() - 1)) ans ans.substring(0, Math.max(0,ans.length() - 1)) ans.substring ans 0 Math.max(0,ans.length() - 1) Math.max Math 0 ans.length() - 1 ans.length() ans.length ans 1 break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {

    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        String ans = "";
        for (int index = 0; index < s.length; index++) {
            switch (s[index]) {
            case '0':
                ans += "0";
                break;
            case '1':
                ans += "1";
                break;
            case 'B':
                ans = ans.substring(0, Math.max(0,ans.length() - 1));
                break;
            }
        }
        System.out.println(ans);
    }
}
