import java.io.BufferedInputStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner s = new Scanner(new BufferedInputStream(System.in));
        String str = s.nextLine();

        StringBuilder sb = new StringBuilder();
        for (int i = 0;i < str.length(); i++) {
            char c = str.charAt(i);
            if (c == '0' || c == '1') {
                if (c == '0')
                sb.append('0');
                else
                sb.append('1');
            } else if (c == 'B') {
                if (sb.length() > 0)
                sb.deleteCharAt(sb.length()-1);
            }

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

} import java.io.BufferedInputStream; BufferedInputStream java.io import java.util.*; util.* java public class Main {

    public static void main(String[] args) {

        Scanner s = new Scanner(new BufferedInputStream(System.in));
        String str = s.nextLine();

        StringBuilder sb = new StringBuilder();
        for (int i = 0;i < str.length(); i++) {
            char c = str.charAt(i);
            if (c == '0' || c == '1') {
                if (c == '0')
                sb.append('0');
                else
                sb.append('1');
            } else if (c == 'B') {
                if (sb.length() > 0)
                sb.deleteCharAt(sb.length()-1);
            }

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

} Main public static void main(String[] args) {

        Scanner s = new Scanner(new BufferedInputStream(System.in));
        String str = s.nextLine();

        StringBuilder sb = new StringBuilder();
        for (int i = 0;i < str.length(); i++) {
            char c = str.charAt(i);
            if (c == '0' || c == '1') {
                if (c == '0')
                sb.append('0');
                else
                sb.append('1');
            } else if (c == 'B') {
                if (sb.length() > 0)
                sb.deleteCharAt(sb.length()-1);
            }

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

        Scanner s = new Scanner(new BufferedInputStream(System.in));
        String str = s.nextLine();

        StringBuilder sb = new StringBuilder();
        for (int i = 0;i < str.length(); i++) {
            char c = str.charAt(i);
            if (c == '0' || c == '1') {
                if (c == '0')
                sb.append('0');
                else
                sb.append('1');
            } else if (c == 'B') {
                if (sb.length() > 0)
                sb.deleteCharAt(sb.length()-1);
            }

        }
        System.out.println(sb.toString());
    } Scanner s = new Scanner(new BufferedInputStream(System.in)); s new Scanner(new BufferedInputStream(System.in)) String str = s.nextLine(); str s.nextLine() s.nextLine s StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = 0;i < str.length(); i++) {
            char c = str.charAt(i);
            if (c == '0' || c == '1') {
                if (c == '0')
                sb.append('0');
                else
                sb.append('1');
            } else if (c == 'B') {
                if (sb.length() > 0)
                sb.deleteCharAt(sb.length()-1);
            }

        } int i = 0; int i = 0; i 0 i < str.length() i str.length() str.length str i++ i++ i {
            char c = str.charAt(i);
            if (c == '0' || c == '1') {
                if (c == '0')
                sb.append('0');
                else
                sb.append('1');
            } else if (c == 'B') {
                if (sb.length() > 0)
                sb.deleteCharAt(sb.length()-1);
            }

        } {
            char c = str.charAt(i);
            if (c == '0' || c == '1') {
                if (c == '0')
                sb.append('0');
                else
                sb.append('1');
            } else if (c == 'B') {
                if (sb.length() > 0)
                sb.deleteCharAt(sb.length()-1);
            }

        } char c = str.charAt(i); c str.charAt(i) str.charAt str i if (c == '0' || c == '1') {
                if (c == '0')
                sb.append('0');
                else
                sb.append('1');
            } else if (c == 'B') {
                if (sb.length() > 0)
                sb.deleteCharAt(sb.length()-1);
            } c == '0' || c == '1' c == '0' c '0' c == '1' c '1' {
                if (c == '0')
                sb.append('0');
                else
                sb.append('1');
            } if (c == '0')
                sb.append('0');
                else
                sb.append('1'); c == '0' c '0' sb.append('0') sb.append sb '0' sb.append('1') sb.append sb '1' if (c == 'B') {
                if (sb.length() > 0)
                sb.deleteCharAt(sb.length()-1);
            } c == 'B' c 'B' {
                if (sb.length() > 0)
                sb.deleteCharAt(sb.length()-1);
            } 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 sb.length()-1 sb.length() sb.length sb 1 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 s = new Scanner(new BufferedInputStream(System.in));
        String str = s.nextLine();

        StringBuilder sb = new StringBuilder();
        for (int i = 0;i < str.length(); i++) {
            char c = str.charAt(i);
            if (c == '0' || c == '1') {
                if (c == '0')
                sb.append('0');
                else
                sb.append('1');
            } else if (c == 'B') {
                if (sb.length() > 0)
                sb.deleteCharAt(sb.length()-1);
            }

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

} public class Main {

    public static void main(String[] args) {

        Scanner s = new Scanner(new BufferedInputStream(System.in));
        String str = s.nextLine();

        StringBuilder sb = new StringBuilder();
        for (int i = 0;i < str.length(); i++) {
            char c = str.charAt(i);
            if (c == '0' || c == '1') {
                if (c == '0')
                sb.append('0');
                else
                sb.append('1');
            } else if (c == 'B') {
                if (sb.length() > 0)
                sb.deleteCharAt(sb.length()-1);
            }

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

} Main
import java.io.BufferedInputStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner s = new Scanner(new BufferedInputStream(System.in));
        String str = s.nextLine();

        StringBuilder sb = new StringBuilder();
        for (int i = 0;i < str.length(); i++) {
            char c = str.charAt(i);
            if (c == '0' || c == '1') {
                if (c == '0')
                sb.append('0');
                else
                sb.append('1');
            } else if (c == 'B') {
                if (sb.length() > 0)
                sb.deleteCharAt(sb.length()-1);
            }

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

}