import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuffer buffer = new StringBuffer();
        int position = -1;
        for (char c : s.toCharArray()) {
            if (c == 'B') {
                if (buffer.length() != 0) {
                    buffer.deleteCharAt(position--);
                }
            } else {
                buffer.insert(++position, c);
            }
        }
        System.out.println(buffer);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuffer buffer = new StringBuffer();
        int position = -1;
        for (char c : s.toCharArray()) {
            if (c == 'B') {
                if (buffer.length() != 0) {
                    buffer.deleteCharAt(position--);
                }
            } else {
                buffer.insert(++position, c);
            }
        }
        System.out.println(buffer);
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuffer buffer = new StringBuffer();
        int position = -1;
        for (char c : s.toCharArray()) {
            if (c == 'B') {
                if (buffer.length() != 0) {
                    buffer.deleteCharAt(position--);
                }
            } else {
                buffer.insert(++position, c);
            }
        }
        System.out.println(buffer);
    } main {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuffer buffer = new StringBuffer();
        int position = -1;
        for (char c : s.toCharArray()) {
            if (c == 'B') {
                if (buffer.length() != 0) {
                    buffer.deleteCharAt(position--);
                }
            } else {
                buffer.insert(++position, c);
            }
        }
        System.out.println(buffer);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String s = in.next(); s in.next() in.next in StringBuffer buffer = new StringBuffer(); buffer new StringBuffer() int position = -1; position -1 1 for (char c : s.toCharArray()) {
            if (c == 'B') {
                if (buffer.length() != 0) {
                    buffer.deleteCharAt(position--);
                }
            } else {
                buffer.insert(++position, c);
            }
        } char c s.toCharArray() s.toCharArray s {
            if (c == 'B') {
                if (buffer.length() != 0) {
                    buffer.deleteCharAt(position--);
                }
            } else {
                buffer.insert(++position, c);
            }
        } {
            if (c == 'B') {
                if (buffer.length() != 0) {
                    buffer.deleteCharAt(position--);
                }
            } else {
                buffer.insert(++position, c);
            }
        } if (c == 'B') {
                if (buffer.length() != 0) {
                    buffer.deleteCharAt(position--);
                }
            } else {
                buffer.insert(++position, c);
            } c == 'B' c 'B' {
                if (buffer.length() != 0) {
                    buffer.deleteCharAt(position--);
                }
            } if (buffer.length() != 0) {
                    buffer.deleteCharAt(position--);
                } buffer.length() != 0 buffer.length() buffer.length buffer 0 {
                    buffer.deleteCharAt(position--);
                } buffer.deleteCharAt(position--) buffer.deleteCharAt buffer position-- position {
                buffer.insert(++position, c);
            } buffer.insert(++position, c) buffer.insert buffer ++position position c System.out.println(buffer) System.out.println System.out System System.out buffer String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuffer buffer = new StringBuffer();
        int position = -1;
        for (char c : s.toCharArray()) {
            if (c == 'B') {
                if (buffer.length() != 0) {
                    buffer.deleteCharAt(position--);
                }
            } else {
                buffer.insert(++position, c);
            }
        }
        System.out.println(buffer);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuffer buffer = new StringBuffer();
        int position = -1;
        for (char c : s.toCharArray()) {
            if (c == 'B') {
                if (buffer.length() != 0) {
                    buffer.deleteCharAt(position--);
                }
            } else {
                buffer.insert(++position, c);
            }
        }
        System.out.println(buffer);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuffer buffer = new StringBuffer();
        int position = -1;
        for (char c : s.toCharArray()) {
            if (c == 'B') {
                if (buffer.length() != 0) {
                    buffer.deleteCharAt(position--);
                }
            } else {
                buffer.insert(++position, c);
            }
        }
        System.out.println(buffer);
    }
}