import java.util.*;
import java.math.*;
     
class Main{
    public static void main(String[] args) {
        
        try(Scanner sc = new Scanner(System.in)){
 
            String s = sc.next();

            StringBuilder sb = new StringBuilder();
            for(int i = 0; i < s.length(); i++){
                String subS = s.substring(i, i + 1);
                if(subS.equals("B")){
                    if(sb.length() != 0){
                        sb.setLength(sb.length() - 1);
                    }
                }else{
                    sb.append(subS);
                }
            }

            System.out.println(sb.toString());
 
        }catch(Exception e){
            e.printStackTrace();
        }        
    }
} import java.util.*; util.* java import java.math.*; math.* java class Main{
    public static void main(String[] args) {
        
        try(Scanner sc = new Scanner(System.in)){
 
            String s = sc.next();

            StringBuilder sb = new StringBuilder();
            for(int i = 0; i < s.length(); i++){
                String subS = s.substring(i, i + 1);
                if(subS.equals("B")){
                    if(sb.length() != 0){
                        sb.setLength(sb.length() - 1);
                    }
                }else{
                    sb.append(subS);
                }
            }

            System.out.println(sb.toString());
 
        }catch(Exception e){
            e.printStackTrace();
        }        
    }
} Main public static void main(String[] args) {
        
        try(Scanner sc = new Scanner(System.in)){
 
            String s = sc.next();

            StringBuilder sb = new StringBuilder();
            for(int i = 0; i < s.length(); i++){
                String subS = s.substring(i, i + 1);
                if(subS.equals("B")){
                    if(sb.length() != 0){
                        sb.setLength(sb.length() - 1);
                    }
                }else{
                    sb.append(subS);
                }
            }

            System.out.println(sb.toString());
 
        }catch(Exception e){
            e.printStackTrace();
        }        
    } main {
        
        try(Scanner sc = new Scanner(System.in)){
 
            String s = sc.next();

            StringBuilder sb = new StringBuilder();
            for(int i = 0; i < s.length(); i++){
                String subS = s.substring(i, i + 1);
                if(subS.equals("B")){
                    if(sb.length() != 0){
                        sb.setLength(sb.length() - 1);
                    }
                }else{
                    sb.append(subS);
                }
            }

            System.out.println(sb.toString());
 
        }catch(Exception e){
            e.printStackTrace();
        }        
    } try(Scanner sc = new Scanner(System.in)){
 
            String s = sc.next();

            StringBuilder sb = new StringBuilder();
            for(int i = 0; i < s.length(); i++){
                String subS = s.substring(i, i + 1);
                if(subS.equals("B")){
                    if(sb.length() != 0){
                        sb.setLength(sb.length() - 1);
                    }
                }else{
                    sb.append(subS);
                }
            }

            System.out.println(sb.toString());
 
        }catch(Exception e){
            e.printStackTrace();
        } catch(Exception e){
            e.printStackTrace();
        } Exception e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
 
            String s = sc.next();

            StringBuilder sb = new StringBuilder();
            for(int i = 0; i < s.length(); i++){
                String subS = s.substring(i, i + 1);
                if(subS.equals("B")){
                    if(sb.length() != 0){
                        sb.setLength(sb.length() - 1);
                    }
                }else{
                    sb.append(subS);
                }
            }

            System.out.println(sb.toString());
 
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0; i < s.length(); i++){
                String subS = s.substring(i, i + 1);
                if(subS.equals("B")){
                    if(sb.length() != 0){
                        sb.setLength(sb.length() - 1);
                    }
                }else{
                    sb.append(subS);
                }
            } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
                String subS = s.substring(i, i + 1);
                if(subS.equals("B")){
                    if(sb.length() != 0){
                        sb.setLength(sb.length() - 1);
                    }
                }else{
                    sb.append(subS);
                }
            } {
                String subS = s.substring(i, i + 1);
                if(subS.equals("B")){
                    if(sb.length() != 0){
                        sb.setLength(sb.length() - 1);
                    }
                }else{
                    sb.append(subS);
                }
            } String subS = s.substring(i, i + 1); subS s.substring(i, i + 1) s.substring s i i + 1 i 1 if(subS.equals("B")){
                    if(sb.length() != 0){
                        sb.setLength(sb.length() - 1);
                    }
                }else{
                    sb.append(subS);
                } subS.equals("B") subS.equals subS "B" {
                    if(sb.length() != 0){
                        sb.setLength(sb.length() - 1);
                    }
                } if(sb.length() != 0){
                        sb.setLength(sb.length() - 1);
                    } sb.length() != 0 sb.length() sb.length sb 0 {
                        sb.setLength(sb.length() - 1);
                    } sb.setLength(sb.length() - 1) sb.setLength sb sb.length() - 1 sb.length() sb.length sb 1 {
                    sb.append(subS);
                } sb.append(subS) sb.append sb subS System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args
import java.util.*;
import java.math.*;
     
class Main{
    public static void main(String[] args) {
        
        try(Scanner sc = new Scanner(System.in)){
 
            String s = sc.next();

            StringBuilder sb = new StringBuilder();
            for(int i = 0; i < s.length(); i++){
                String subS = s.substring(i, i + 1);
                if(subS.equals("B")){
                    if(sb.length() != 0){
                        sb.setLength(sb.length() - 1);
                    }
                }else{
                    sb.append(subS);
                }
            }

            System.out.println(sb.toString());
 
        }catch(Exception e){
            e.printStackTrace();
        }        
    }
}