import java.util.Scanner;

/**
 * ABC043B
 */
public class Main {

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

        String S = sc.nextLine();
        StringBuilder ans = new StringBuilder();

        for (int i = 0; i < S.length(); i++) {
            char c = S.charAt(i);

            if (c == '0') {
                ans.append('0');
            } else if (c == '1') {
                ans.append('1');
            } else if (c == 'B') {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            }
        }

        System.out.println(ans.toString());
        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {

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

        String S = sc.nextLine();
        StringBuilder ans = new StringBuilder();

        for (int i = 0; i < S.length(); i++) {
            char c = S.charAt(i);

            if (c == '0') {
                ans.append('0');
            } else if (c == '1') {
                ans.append('1');
            } else if (c == 'B') {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            }
        }

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

        String S = sc.nextLine();
        StringBuilder ans = new StringBuilder();

        for (int i = 0; i < S.length(); i++) {
            char c = S.charAt(i);

            if (c == '0') {
                ans.append('0');
            } else if (c == '1') {
                ans.append('1');
            } else if (c == 'B') {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            }
        }

        System.out.println(ans.toString());
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        String S = sc.nextLine();
        StringBuilder ans = new StringBuilder();

        for (int i = 0; i < S.length(); i++) {
            char c = S.charAt(i);

            if (c == '0') {
                ans.append('0');
            } else if (c == '1') {
                ans.append('1');
            } else if (c == 'B') {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            }
        }

        System.out.println(ans.toString());
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc StringBuilder ans = new StringBuilder(); ans new StringBuilder() for (int i = 0; i < S.length(); i++) {
            char c = S.charAt(i);

            if (c == '0') {
                ans.append('0');
            } else if (c == '1') {
                ans.append('1');
            } else if (c == 'B') {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            }
        } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
            char c = S.charAt(i);

            if (c == '0') {
                ans.append('0');
            } else if (c == '1') {
                ans.append('1');
            } else if (c == 'B') {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            }
        } {
            char c = S.charAt(i);

            if (c == '0') {
                ans.append('0');
            } else if (c == '1') {
                ans.append('1');
            } else if (c == 'B') {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            }
        } char c = S.charAt(i); c S.charAt(i) S.charAt S i if (c == '0') {
                ans.append('0');
            } else if (c == '1') {
                ans.append('1');
            } else if (c == 'B') {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            } c == '0' c '0' {
                ans.append('0');
            } ans.append('0') ans.append ans '0' if (c == '1') {
                ans.append('1');
            } else if (c == 'B') {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            } c == '1' c '1' {
                ans.append('1');
            } ans.append('1') ans.append ans '1' if (c == 'B') {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            } c == 'B' c 'B' {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            } if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                } ans.length() != 0 ans.length() ans.length ans 0 {
                    ans.deleteCharAt(ans.length() - 1);                    
                } ans.deleteCharAt(ans.length() - 1) ans.deleteCharAt ans ans.length() - 1 ans.length() ans.length ans 1 System.out.println(ans.toString()) System.out.println System.out System System.out ans.toString() ans.toString ans 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.nextLine();
        StringBuilder ans = new StringBuilder();

        for (int i = 0; i < S.length(); i++) {
            char c = S.charAt(i);

            if (c == '0') {
                ans.append('0');
            } else if (c == '1') {
                ans.append('1');
            } else if (c == 'B') {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            }
        }

        System.out.println(ans.toString());
        sc.close();
    }
} public class Main {

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

        String S = sc.nextLine();
        StringBuilder ans = new StringBuilder();

        for (int i = 0; i < S.length(); i++) {
            char c = S.charAt(i);

            if (c == '0') {
                ans.append('0');
            } else if (c == '1') {
                ans.append('1');
            } else if (c == 'B') {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            }
        }

        System.out.println(ans.toString());
        sc.close();
    }
} Main
import java.util.Scanner;

/**
 * ABC043B
 */
public class Main {

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

        String S = sc.nextLine();
        StringBuilder ans = new StringBuilder();

        for (int i = 0; i < S.length(); i++) {
            char c = S.charAt(i);

            if (c == '0') {
                ans.append('0');
            } else if (c == '1') {
                ans.append('1');
            } else if (c == 'B') {
                if (ans.length() != 0) {
                    ans.deleteCharAt(ans.length() - 1);                    
                }
            }
        }

        System.out.println(ans.toString());
        sc.close();
    }
}