import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] sArray = s.split("");
        String result = "";

        for (int i = 0; i < sArray.length; i++) {
            if ("0".equals(sArray[i])) {
                result += "0";
            } else if ("1".equals(sArray[i])) {
                result += "1";
            } else if ("B".equals(sArray[i])) {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            }
        }
        System.out.println(result);
    }

} 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[] sArray = s.split("");
        String result = "";

        for (int i = 0; i < sArray.length; i++) {
            if ("0".equals(sArray[i])) {
                result += "0";
            } else if ("1".equals(sArray[i])) {
                result += "1";
            } else if ("B".equals(sArray[i])) {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            }
        }
        System.out.println(result);
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] sArray = s.split("");
        String result = "";

        for (int i = 0; i < sArray.length; i++) {
            if ("0".equals(sArray[i])) {
                result += "0";
            } else if ("1".equals(sArray[i])) {
                result += "1";
            } else if ("B".equals(sArray[i])) {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            }
        }
        System.out.println(result);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] sArray = s.split("");
        String result = "";

        for (int i = 0; i < sArray.length; i++) {
            if ("0".equals(sArray[i])) {
                result += "0";
            } else if ("1".equals(sArray[i])) {
                result += "1";
            } else if ("B".equals(sArray[i])) {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            }
        }
        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String[] sArray = s.split(""); sArray s.split("") s.split s "" String result = ""; result "" for (int i = 0; i < sArray.length; i++) {
            if ("0".equals(sArray[i])) {
                result += "0";
            } else if ("1".equals(sArray[i])) {
                result += "1";
            } else if ("B".equals(sArray[i])) {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            }
        } int i = 0; int i = 0; i 0 i < sArray.length i sArray.length sArray sArray.length i++ i++ i {
            if ("0".equals(sArray[i])) {
                result += "0";
            } else if ("1".equals(sArray[i])) {
                result += "1";
            } else if ("B".equals(sArray[i])) {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            }
        } {
            if ("0".equals(sArray[i])) {
                result += "0";
            } else if ("1".equals(sArray[i])) {
                result += "1";
            } else if ("B".equals(sArray[i])) {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            }
        } if ("0".equals(sArray[i])) {
                result += "0";
            } else if ("1".equals(sArray[i])) {
                result += "1";
            } else if ("B".equals(sArray[i])) {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            } "0".equals(sArray[i]) "0".equals "0" sArray[i] sArray i {
                result += "0";
            } result += "0" result "0" if ("1".equals(sArray[i])) {
                result += "1";
            } else if ("B".equals(sArray[i])) {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            } "1".equals(sArray[i]) "1".equals "1" sArray[i] sArray i {
                result += "1";
            } result += "1" result "1" if ("B".equals(sArray[i])) {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            } "B".equals(sArray[i]) "B".equals "B" sArray[i] sArray i {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            } if ("".equals(result)) {
                    continue;
                } "".equals(result) "".equals "" result {
                    continue;
                } continue; result = result.substring(0, result.length() - 1) result result.substring(0, result.length() - 1) result.substring result 0 result.length() - 1 result.length() result.length result 1 System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] sArray = s.split("");
        String result = "";

        for (int i = 0; i < sArray.length; i++) {
            if ("0".equals(sArray[i])) {
                result += "0";
            } else if ("1".equals(sArray[i])) {
                result += "1";
            } else if ("B".equals(sArray[i])) {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            }
        }
        System.out.println(result);
    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] sArray = s.split("");
        String result = "";

        for (int i = 0; i < sArray.length; i++) {
            if ("0".equals(sArray[i])) {
                result += "0";
            } else if ("1".equals(sArray[i])) {
                result += "1";
            } else if ("B".equals(sArray[i])) {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            }
        }
        System.out.println(result);
    }

} 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[] sArray = s.split("");
        String result = "";

        for (int i = 0; i < sArray.length; i++) {
            if ("0".equals(sArray[i])) {
                result += "0";
            } else if ("1".equals(sArray[i])) {
                result += "1";
            } else if ("B".equals(sArray[i])) {
                if ("".equals(result)) {
                    continue;
                }
                result = result.substring(0, result.length() - 1);
            }
        }
        System.out.println(result);
    }

}
