import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int i = 0;
        while (s.contains("B")) {
            if (s.charAt(i) == 'B') {
                s = s.replaceFirst("(.?B)", "");
                i = -1;
            }
            i++;
        }
        System.out.println(s);
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int i = 0;
        while (s.contains("B")) {
            if (s.charAt(i) == 'B') {
                s = s.replaceFirst("(.?B)", "");
                i = -1;
            }
            i++;
        }
        System.out.println(s);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int i = 0;
        while (s.contains("B")) {
            if (s.charAt(i) == 'B') {
                s = s.replaceFirst("(.?B)", "");
                i = -1;
            }
            i++;
        }
        System.out.println(s);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int i = 0;
        while (s.contains("B")) {
            if (s.charAt(i) == 'B') {
                s = s.replaceFirst("(.?B)", "");
                i = -1;
            }
            i++;
        }
        System.out.println(s);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int i = 0; i 0 while (s.contains("B")) {
            if (s.charAt(i) == 'B') {
                s = s.replaceFirst("(.?B)", "");
                i = -1;
            }
            i++;
        } s.contains("B") s.contains s "B" {
            if (s.charAt(i) == 'B') {
                s = s.replaceFirst("(.?B)", "");
                i = -1;
            }
            i++;
        } if (s.charAt(i) == 'B') {
                s = s.replaceFirst("(.?B)", "");
                i = -1;
            } s.charAt(i) == 'B' s.charAt(i) s.charAt s i 'B' {
                s = s.replaceFirst("(.?B)", "");
                i = -1;
            } s = s.replaceFirst("(.?B)", "") s s.replaceFirst("(.?B)", "") s.replaceFirst s "(.?B)" "" i = -1 i -1 1 i++ i System.out.println(s) System.out.println System.out System System.out s String[] args args
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int i = 0;
        while (s.contains("B")) {
            if (s.charAt(i) == 'B') {
                s = s.replaceFirst("(.?B)", "");
                i = -1;
            }
            i++;
        }
        System.out.println(s);
    }
}