import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == 'B'){
                if(sb.length() != 0){
                    sb.deleteCharAt(sb.length() - 1);
                }
            }
            else{
                sb.append(s.charAt(i));
            }
        }
        System.out.println(sb);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == 'B'){
                if(sb.length() != 0){
                    sb.deleteCharAt(sb.length() - 1);
                }
            }
            else{
                sb.append(s.charAt(i));
            }
        }
        System.out.println(sb);
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == 'B'){
                if(sb.length() != 0){
                    sb.deleteCharAt(sb.length() - 1);
                }
            }
            else{
                sb.append(s.charAt(i));
            }
        }
        System.out.println(sb);
    } main {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == 'B'){
                if(sb.length() != 0){
                    sb.deleteCharAt(sb.length() - 1);
                }
            }
            else{
                sb.append(s.charAt(i));
            }
        }
        System.out.println(sb);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String s = in.next(); s in.next() in.next in StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == 'B'){
                if(sb.length() != 0){
                    sb.deleteCharAt(sb.length() - 1);
                }
            }
            else{
                sb.append(s.charAt(i));
            }
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            if(s.charAt(i) == 'B'){
                if(sb.length() != 0){
                    sb.deleteCharAt(sb.length() - 1);
                }
            }
            else{
                sb.append(s.charAt(i));
            }
        } {
            if(s.charAt(i) == 'B'){
                if(sb.length() != 0){
                    sb.deleteCharAt(sb.length() - 1);
                }
            }
            else{
                sb.append(s.charAt(i));
            }
        } if(s.charAt(i) == 'B'){
                if(sb.length() != 0){
                    sb.deleteCharAt(sb.length() - 1);
                }
            }
            else{
                sb.append(s.charAt(i));
            } s.charAt(i) == 'B' s.charAt(i) s.charAt s i 'B' {
                if(sb.length() != 0){
                    sb.deleteCharAt(sb.length() - 1);
                }
            } if(sb.length() != 0){
                    sb.deleteCharAt(sb.length() - 1);
                } sb.length() != 0 sb.length() sb.length sb 0 {
                    sb.deleteCharAt(sb.length() - 1);
                } sb.deleteCharAt(sb.length() - 1) sb.deleteCharAt sb sb.length() - 1 sb.length() sb.length sb 1 {
                sb.append(s.charAt(i));
            } sb.append(s.charAt(i)) sb.append sb s.charAt(i) s.charAt s i System.out.println(sb) System.out.println System.out System System.out sb String[] args args public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == 'B'){
                if(sb.length() != 0){
                    sb.deleteCharAt(sb.length() - 1);
                }
            }
            else{
                sb.append(s.charAt(i));
            }
        }
        System.out.println(sb);
    }
} public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == 'B'){
                if(sb.length() != 0){
                    sb.deleteCharAt(sb.length() - 1);
                }
            }
            else{
                sb.append(s.charAt(i));
            }
        }
        System.out.println(sb);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == 'B'){
                if(sb.length() != 0){
                    sb.deleteCharAt(sb.length() - 1);
                }
            }
            else{
                sb.append(s.charAt(i));
            }
        }
        System.out.println(sb);
    }
}
