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

public class Main {

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

        String s;
        char schar[] = new char[10];

        s = sc.next();
        
        for (int i = 0; i < s.length(); i++) {
            schar[i] = s.charAt(i);
        }

        char schar_out[] = new char[s.length()];
        int j = 0;
        for (int i = 0; i < s.length(); i++) {
            if (schar[i] == 'B') {
                if (j != 0) {
                    j--;
                    schar_out[j] = '\0';
                }
            } else {
                schar_out[j] = schar[i];
                j++;
            }

        }
        
        String sstring_out = new String(schar_out);
        out.println(sstring_out.trim());
        sc.close();
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {

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

        String s;
        char schar[] = new char[10];

        s = sc.next();
        
        for (int i = 0; i < s.length(); i++) {
            schar[i] = s.charAt(i);
        }

        char schar_out[] = new char[s.length()];
        int j = 0;
        for (int i = 0; i < s.length(); i++) {
            if (schar[i] == 'B') {
                if (j != 0) {
                    j--;
                    schar_out[j] = '\0';
                }
            } else {
                schar_out[j] = schar[i];
                j++;
            }

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

        String s;
        char schar[] = new char[10];

        s = sc.next();
        
        for (int i = 0; i < s.length(); i++) {
            schar[i] = s.charAt(i);
        }

        char schar_out[] = new char[s.length()];
        int j = 0;
        for (int i = 0; i < s.length(); i++) {
            if (schar[i] == 'B') {
                if (j != 0) {
                    j--;
                    schar_out[j] = '\0';
                }
            } else {
                schar_out[j] = schar[i];
                j++;
            }

        }
        
        String sstring_out = new String(schar_out);
        out.println(sstring_out.trim());
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        PrintStream out = new PrintStream(System.out);

        String s;
        char schar[] = new char[10];

        s = sc.next();
        
        for (int i = 0; i < s.length(); i++) {
            schar[i] = s.charAt(i);
        }

        char schar_out[] = new char[s.length()];
        int j = 0;
        for (int i = 0; i < s.length(); i++) {
            if (schar[i] == 'B') {
                if (j != 0) {
                    j--;
                    schar_out[j] = '\0';
                }
            } else {
                schar_out[j] = schar[i];
                j++;
            }

        }
        
        String sstring_out = new String(schar_out);
        out.println(sstring_out.trim());
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintStream out = new PrintStream(System.out); out new PrintStream(System.out) String s; s char schar[] = new char[10]; schar new char[10] 10 s = sc.next() s sc.next() sc.next sc for (int i = 0; i < s.length(); i++) {
            schar[i] = s.charAt(i);
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            schar[i] = s.charAt(i);
        } {
            schar[i] = s.charAt(i);
        } schar[i] = s.charAt(i) schar[i] schar i s.charAt(i) s.charAt s i char schar_out[] = new char[s.length()]; schar_out new char[s.length()] s.length() s.length s int j = 0; j 0 for (int i = 0; i < s.length(); i++) {
            if (schar[i] == 'B') {
                if (j != 0) {
                    j--;
                    schar_out[j] = '\0';
                }
            } else {
                schar_out[j] = schar[i];
                j++;
            }

        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            if (schar[i] == 'B') {
                if (j != 0) {
                    j--;
                    schar_out[j] = '\0';
                }
            } else {
                schar_out[j] = schar[i];
                j++;
            }

        } {
            if (schar[i] == 'B') {
                if (j != 0) {
                    j--;
                    schar_out[j] = '\0';
                }
            } else {
                schar_out[j] = schar[i];
                j++;
            }

        } if (schar[i] == 'B') {
                if (j != 0) {
                    j--;
                    schar_out[j] = '\0';
                }
            } else {
                schar_out[j] = schar[i];
                j++;
            } schar[i] == 'B' schar[i] schar i 'B' {
                if (j != 0) {
                    j--;
                    schar_out[j] = '\0';
                }
            } if (j != 0) {
                    j--;
                    schar_out[j] = '\0';
                } j != 0 j 0 {
                    j--;
                    schar_out[j] = '\0';
                } j-- j schar_out[j] = '\0' schar_out[j] schar_out j '\0' {
                schar_out[j] = schar[i];
                j++;
            } schar_out[j] = schar[i] schar_out[j] schar_out j schar[i] schar i j++ j String sstring_out = new String(schar_out); sstring_out new String(schar_out) out.println(sstring_out.trim()) out.println out sstring_out.trim() sstring_out.trim sstring_out sc.close() sc.close sc String[] args args public class Main {

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

        String s;
        char schar[] = new char[10];

        s = sc.next();
        
        for (int i = 0; i < s.length(); i++) {
            schar[i] = s.charAt(i);
        }

        char schar_out[] = new char[s.length()];
        int j = 0;
        for (int i = 0; i < s.length(); i++) {
            if (schar[i] == 'B') {
                if (j != 0) {
                    j--;
                    schar_out[j] = '\0';
                }
            } else {
                schar_out[j] = schar[i];
                j++;
            }

        }
        
        String sstring_out = new String(schar_out);
        out.println(sstring_out.trim());
        sc.close();
    }
} public class Main {

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

        String s;
        char schar[] = new char[10];

        s = sc.next();
        
        for (int i = 0; i < s.length(); i++) {
            schar[i] = s.charAt(i);
        }

        char schar_out[] = new char[s.length()];
        int j = 0;
        for (int i = 0; i < s.length(); i++) {
            if (schar[i] == 'B') {
                if (j != 0) {
                    j--;
                    schar_out[j] = '\0';
                }
            } else {
                schar_out[j] = schar[i];
                j++;
            }

        }
        
        String sstring_out = new String(schar_out);
        out.println(sstring_out.trim());
        sc.close();
    }
} Main
import java.io.*;
import java.util.*;

public class Main {

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

        String s;
        char schar[] = new char[10];

        s = sc.next();
        
        for (int i = 0; i < s.length(); i++) {
            schar[i] = s.charAt(i);
        }

        char schar_out[] = new char[s.length()];
        int j = 0;
        for (int i = 0; i < s.length(); i++) {
            if (schar[i] == 'B') {
                if (j != 0) {
                    j--;
                    schar_out[j] = '\0';
                }
            } else {
                schar_out[j] = schar[i];
                j++;
            }

        }
        
        String sstring_out = new String(schar_out);
        out.println(sstring_out.trim());
        sc.close();
    }
}