import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String res = "";
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'B') {
                if (res.equals("")) {
                    continue;
                }
                res = res.substring(0, res.length() - 1);
            } else {
                res += String.valueOf(s.charAt(i));
            }
        }
        System.out.println(res);
        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.next();
        String res = "";
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'B') {
                if (res.equals("")) {
                    continue;
                }
                res = res.substring(0, res.length() - 1);
            } else {
                res += String.valueOf(s.charAt(i));
            }
        }
        System.out.println(res);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String res = "";
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'B') {
                if (res.equals("")) {
                    continue;
                }
                res = res.substring(0, res.length() - 1);
            } else {
                res += String.valueOf(s.charAt(i));
            }
        }
        System.out.println(res);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String res = "";
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'B') {
                if (res.equals("")) {
                    continue;
                }
                res = res.substring(0, res.length() - 1);
            } else {
                res += String.valueOf(s.charAt(i));
            }
        }
        System.out.println(res);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String res = ""; res "" for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'B') {
                if (res.equals("")) {
                    continue;
                }
                res = res.substring(0, res.length() - 1);
            } else {
                res += String.valueOf(s.charAt(i));
            }
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            if (s.charAt(i) == 'B') {
                if (res.equals("")) {
                    continue;
                }
                res = res.substring(0, res.length() - 1);
            } else {
                res += String.valueOf(s.charAt(i));
            }
        } {
            if (s.charAt(i) == 'B') {
                if (res.equals("")) {
                    continue;
                }
                res = res.substring(0, res.length() - 1);
            } else {
                res += String.valueOf(s.charAt(i));
            }
        } if (s.charAt(i) == 'B') {
                if (res.equals("")) {
                    continue;
                }
                res = res.substring(0, res.length() - 1);
            } else {
                res += String.valueOf(s.charAt(i));
            } s.charAt(i) == 'B' s.charAt(i) s.charAt s i 'B' {
                if (res.equals("")) {
                    continue;
                }
                res = res.substring(0, res.length() - 1);
            } if (res.equals("")) {
                    continue;
                } res.equals("") res.equals res "" {
                    continue;
                } continue; res = res.substring(0, res.length() - 1) res res.substring(0, res.length() - 1) res.substring res 0 res.length() - 1 res.length() res.length res 1 {
                res += String.valueOf(s.charAt(i));
            } res += String.valueOf(s.charAt(i)) res String.valueOf(s.charAt(i)) String.valueOf String s.charAt(i) s.charAt s i System.out.println(res) System.out.println System.out System System.out res 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.next();
        String res = "";
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'B') {
                if (res.equals("")) {
                    continue;
                }
                res = res.substring(0, res.length() - 1);
            } else {
                res += String.valueOf(s.charAt(i));
            }
        }
        System.out.println(res);
        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String res = "";
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'B') {
                if (res.equals("")) {
                    continue;
                }
                res = res.substring(0, res.length() - 1);
            } else {
                res += String.valueOf(s.charAt(i));
            }
        }
        System.out.println(res);
        sc.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String res = "";
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'B') {
                if (res.equals("")) {
                    continue;
                }
                res = res.substring(0, res.length() - 1);
            } else {
                res += String.valueOf(s.charAt(i));
            }
        }
        System.out.println(res);
        sc.close();
    }
}