import java.io.*;
import java.util.*;

public class Main{
	public static void main(String args[]){
    	Scanner in = new Scanner(System.in);
      	char[] s = in.next().toCharArray();
      	char[] output = new char[s.length];
      	int k=0;
		 for(int i = 0;i<s.length;i++){
         	if(s[i]!='B'){
           		output[k++] = s[i]; 
            }
           else{
             if(k>0)
           		k--;
           }
         }
      		for(int i =0;i<k;i++){
            	System.out.print(output[i]);
            }
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main{
	public static void main(String args[]){
    	Scanner in = new Scanner(System.in);
      	char[] s = in.next().toCharArray();
      	char[] output = new char[s.length];
      	int k=0;
		 for(int i = 0;i<s.length;i++){
         	if(s[i]!='B'){
           		output[k++] = s[i]; 
            }
           else{
             if(k>0)
           		k--;
           }
         }
      		for(int i =0;i<k;i++){
            	System.out.print(output[i]);
            }
    }
} Main public static void main(String args[]){
    	Scanner in = new Scanner(System.in);
      	char[] s = in.next().toCharArray();
      	char[] output = new char[s.length];
      	int k=0;
		 for(int i = 0;i<s.length;i++){
         	if(s[i]!='B'){
           		output[k++] = s[i]; 
            }
           else{
             if(k>0)
           		k--;
           }
         }
      		for(int i =0;i<k;i++){
            	System.out.print(output[i]);
            }
    } main {
    	Scanner in = new Scanner(System.in);
      	char[] s = in.next().toCharArray();
      	char[] output = new char[s.length];
      	int k=0;
		 for(int i = 0;i<s.length;i++){
         	if(s[i]!='B'){
           		output[k++] = s[i]; 
            }
           else{
             if(k>0)
           		k--;
           }
         }
      		for(int i =0;i<k;i++){
            	System.out.print(output[i]);
            }
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) char[] s = in.next().toCharArray(); s in.next().toCharArray() in.next().toCharArray in.next() in.next in char[] output = new char[s.length]; output new char[s.length] s.length s s.length int k=0; k 0 for(int i = 0;i<s.length;i++){
         	if(s[i]!='B'){
           		output[k++] = s[i]; 
            }
           else{
             if(k>0)
           		k--;
           }
         } int i = 0; int i = 0; i 0 i<s.length i s.length s s.length i++ i++ i {
         	if(s[i]!='B'){
           		output[k++] = s[i]; 
            }
           else{
             if(k>0)
           		k--;
           }
         } {
         	if(s[i]!='B'){
           		output[k++] = s[i]; 
            }
           else{
             if(k>0)
           		k--;
           }
         } if(s[i]!='B'){
           		output[k++] = s[i]; 
            }
           else{
             if(k>0)
           		k--;
           } s[i]!='B' s[i] s i 'B' {
           		output[k++] = s[i]; 
            } output[k++] = s[i] output[k++] output k++ k s[i] s i {
             if(k>0)
           		k--;
           } if(k>0)
           		k--; k>0 k 0 k-- k for(int i =0;i<k;i++){
            	System.out.print(output[i]);
            } int i =0; int i =0; i 0 i<k i k i++ i++ i {
            	System.out.print(output[i]);
            } {
            	System.out.print(output[i]);
            } System.out.print(output[i]) System.out.print System.out System System.out output[i] output i String args[] args public class Main{
	public static void main(String args[]){
    	Scanner in = new Scanner(System.in);
      	char[] s = in.next().toCharArray();
      	char[] output = new char[s.length];
      	int k=0;
		 for(int i = 0;i<s.length;i++){
         	if(s[i]!='B'){
           		output[k++] = s[i]; 
            }
           else{
             if(k>0)
           		k--;
           }
         }
      		for(int i =0;i<k;i++){
            	System.out.print(output[i]);
            }
    }
} public class Main{
	public static void main(String args[]){
    	Scanner in = new Scanner(System.in);
      	char[] s = in.next().toCharArray();
      	char[] output = new char[s.length];
      	int k=0;
		 for(int i = 0;i<s.length;i++){
         	if(s[i]!='B'){
           		output[k++] = s[i]; 
            }
           else{
             if(k>0)
           		k--;
           }
         }
      		for(int i =0;i<k;i++){
            	System.out.print(output[i]);
            }
    }
} Main
import java.io.*;
import java.util.*;

public class Main{
	public static void main(String args[]){
    	Scanner in = new Scanner(System.in);
      	char[] s = in.next().toCharArray();
      	char[] output = new char[s.length];
      	int k=0;
		 for(int i = 0;i<s.length;i++){
         	if(s[i]!='B'){
           		output[k++] = s[i]; 
            }
           else{
             if(k>0)
           		k--;
           }
         }
      		for(int i =0;i<k;i++){
            	System.out.print(output[i]);
            }
    }
}