import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;

class Main {
    public static void main(final String[] args) throws Exception {

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            List<String> input = Arrays.asList(br.readLine().split(""));
            
            String ans = "";
            for (int i = 0; i < input.size(); i++) {
                if (!input.get(i).equals("B")) {
                    ans += input.get(i);
                } else {
                    if (ans.length() > 0) {
                        ans = ans.substring(0, ans.length() - 1);
                    }
                }
            }

            System.out.println(ans);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.List; List java.util class Main {
    public static void main(final String[] args) throws Exception {

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            List<String> input = Arrays.asList(br.readLine().split(""));
            
            String ans = "";
            for (int i = 0; i < input.size(); i++) {
                if (!input.get(i).equals("B")) {
                    ans += input.get(i);
                } else {
                    if (ans.length() > 0) {
                        ans = ans.substring(0, ans.length() - 1);
                    }
                }
            }

            System.out.println(ans);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
} Main public static void main(final String[] args) throws Exception {

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            List<String> input = Arrays.asList(br.readLine().split(""));
            
            String ans = "";
            for (int i = 0; i < input.size(); i++) {
                if (!input.get(i).equals("B")) {
                    ans += input.get(i);
                } else {
                    if (ans.length() > 0) {
                        ans = ans.substring(0, ans.length() - 1);
                    }
                }
            }

            System.out.println(ans);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    } main {

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            List<String> input = Arrays.asList(br.readLine().split(""));
            
            String ans = "";
            for (int i = 0; i < input.size(); i++) {
                if (!input.get(i).equals("B")) {
                    ans += input.get(i);
                } else {
                    if (ans.length() > 0) {
                        ans = ans.substring(0, ans.length() - 1);
                    }
                }
            }

            System.out.println(ans);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    } try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            List<String> input = Arrays.asList(br.readLine().split(""));
            
            String ans = "";
            for (int i = 0; i < input.size(); i++) {
                if (!input.get(i).equals("B")) {
                    ans += input.get(i);
                } else {
                    if (ans.length() > 0) {
                        ans = ans.substring(0, ans.length() - 1);
                    }
                }
            }

            System.out.println(ans);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } IOException | NumberFormatException e {
            e.printStackTrace();
            System.exit(0);
        } e.printStackTrace() e.printStackTrace e System.exit(0) System.exit System 0 catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        } final Exception e {
            e.printStackTrace();
            System.exit(0);
        } e.printStackTrace() e.printStackTrace e System.exit(0) System.exit System 0 {
            List<String> input = Arrays.asList(br.readLine().split(""));
            
            String ans = "";
            for (int i = 0; i < input.size(); i++) {
                if (!input.get(i).equals("B")) {
                    ans += input.get(i);
                } else {
                    if (ans.length() > 0) {
                        ans = ans.substring(0, ans.length() - 1);
                    }
                }
            }

            System.out.println(ans);
        } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) List<String> input = Arrays.asList(br.readLine().split("")); input Arrays.asList(br.readLine().split("")) Arrays.asList Arrays br.readLine().split("") br.readLine().split br.readLine() br.readLine br "" String ans = ""; ans "" for (int i = 0; i < input.size(); i++) {
                if (!input.get(i).equals("B")) {
                    ans += input.get(i);
                } else {
                    if (ans.length() > 0) {
                        ans = ans.substring(0, ans.length() - 1);
                    }
                }
            } int i = 0; int i = 0; i 0 i < input.size() i input.size() input.size input i++ i++ i {
                if (!input.get(i).equals("B")) {
                    ans += input.get(i);
                } else {
                    if (ans.length() > 0) {
                        ans = ans.substring(0, ans.length() - 1);
                    }
                }
            } {
                if (!input.get(i).equals("B")) {
                    ans += input.get(i);
                } else {
                    if (ans.length() > 0) {
                        ans = ans.substring(0, ans.length() - 1);
                    }
                }
            } if (!input.get(i).equals("B")) {
                    ans += input.get(i);
                } else {
                    if (ans.length() > 0) {
                        ans = ans.substring(0, ans.length() - 1);
                    }
                } !input.get(i).equals("B") input.get(i).equals("B") input.get(i).equals input.get(i) input.get input i "B" {
                    ans += input.get(i);
                } ans += input.get(i) ans input.get(i) input.get input i {
                    if (ans.length() > 0) {
                        ans = ans.substring(0, ans.length() - 1);
                    }
                } if (ans.length() > 0) {
                        ans = ans.substring(0, ans.length() - 1);
                    } ans.length() > 0 ans.length() ans.length ans 0 {
                        ans = ans.substring(0, ans.length() - 1);
                    } ans = ans.substring(0, ans.length() - 1) ans ans.substring(0, ans.length() - 1) ans.substring ans 0 ans.length() - 1 ans.length() ans.length ans 1 System.out.println(ans) System.out.println System.out System System.out ans final String[] args args
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;

class Main {
    public static void main(final String[] args) throws Exception {

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            List<String> input = Arrays.asList(br.readLine().split(""));
            
            String ans = "";
            for (int i = 0; i < input.size(); i++) {
                if (!input.get(i).equals("B")) {
                    ans += input.get(i);
                } else {
                    if (ans.length() > 0) {
                        ans = ans.substring(0, ans.length() - 1);
                    }
                }
            }

            System.out.println(ans);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}