import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        List<String> list = new ArrayList<>();
        for(int i=0;i<array.length;i++) {
            if (array[i]=='B') {
                if (list.size() != 0) {
                    list.remove(list.size()-1);
                }
            } else {
                list.add(String.valueOf(array[i]));
            }
        }
        for (String s: list) {
            System.out.print(s);
        }
        System.out.println();

    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        List<String> list = new ArrayList<>();
        for(int i=0;i<array.length;i++) {
            if (array[i]=='B') {
                if (list.size() != 0) {
                    list.remove(list.size()-1);
                }
            } else {
                list.add(String.valueOf(array[i]));
            }
        }
        for (String s: list) {
            System.out.print(s);
        }
        System.out.println();

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        List<String> list = new ArrayList<>();
        for(int i=0;i<array.length;i++) {
            if (array[i]=='B') {
                if (list.size() != 0) {
                    list.remove(list.size()-1);
                }
            } else {
                list.add(String.valueOf(array[i]));
            }
        }
        for (String s: list) {
            System.out.print(s);
        }
        System.out.println();

    } main {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        List<String> list = new ArrayList<>();
        for(int i=0;i<array.length;i++) {
            if (array[i]=='B') {
                if (list.size() != 0) {
                    list.remove(list.size()-1);
                }
            } else {
                list.add(String.valueOf(array[i]));
            }
        }
        for (String s: list) {
            System.out.print(s);
        }
        System.out.println();

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] array = sc.next().toCharArray(); array sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc List<String> list = new ArrayList<>(); list new ArrayList<>() for(int i=0;i<array.length;i++) {
            if (array[i]=='B') {
                if (list.size() != 0) {
                    list.remove(list.size()-1);
                }
            } else {
                list.add(String.valueOf(array[i]));
            }
        } int i=0; int i=0; i 0 i<array.length i array.length array array.length i++ i++ i {
            if (array[i]=='B') {
                if (list.size() != 0) {
                    list.remove(list.size()-1);
                }
            } else {
                list.add(String.valueOf(array[i]));
            }
        } {
            if (array[i]=='B') {
                if (list.size() != 0) {
                    list.remove(list.size()-1);
                }
            } else {
                list.add(String.valueOf(array[i]));
            }
        } if (array[i]=='B') {
                if (list.size() != 0) {
                    list.remove(list.size()-1);
                }
            } else {
                list.add(String.valueOf(array[i]));
            } array[i]=='B' array[i] array i 'B' {
                if (list.size() != 0) {
                    list.remove(list.size()-1);
                }
            } if (list.size() != 0) {
                    list.remove(list.size()-1);
                } list.size() != 0 list.size() list.size list 0 {
                    list.remove(list.size()-1);
                } list.remove(list.size()-1) list.remove list list.size()-1 list.size() list.size list 1 {
                list.add(String.valueOf(array[i]));
            } list.add(String.valueOf(array[i])) list.add list String.valueOf(array[i]) String.valueOf String array[i] array i for (String s: list) {
            System.out.print(s);
        } String s list {
            System.out.print(s);
        } {
            System.out.print(s);
        } System.out.print(s) System.out.print System.out System System.out s System.out.println() System.out.println System.out System System.out String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        List<String> list = new ArrayList<>();
        for(int i=0;i<array.length;i++) {
            if (array[i]=='B') {
                if (list.size() != 0) {
                    list.remove(list.size()-1);
                }
            } else {
                list.add(String.valueOf(array[i]));
            }
        }
        for (String s: list) {
            System.out.print(s);
        }
        System.out.println();

    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        List<String> list = new ArrayList<>();
        for(int i=0;i<array.length;i++) {
            if (array[i]=='B') {
                if (list.size() != 0) {
                    list.remove(list.size()-1);
                }
            } else {
                list.add(String.valueOf(array[i]));
            }
        }
        for (String s: list) {
            System.out.print(s);
        }
        System.out.println();

    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] array = sc.next().toCharArray();
        List<String> list = new ArrayList<>();
        for(int i=0;i<array.length;i++) {
            if (array[i]=='B') {
                if (list.size() != 0) {
                    list.remove(list.size()-1);
                }
            } else {
                list.add(String.valueOf(array[i]));
            }
        }
        for (String s: list) {
            System.out.print(s);
        }
        System.out.println();

    }
}