import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      
        String s = sc.next();
        StringBuilder answer = new StringBuilder();
        
        for(int i=0;i < s.length();i++){
          //System.out.println(s.charAt(i));
          
          if (String.valueOf(s.charAt(i)).equals("B")){
            if (answer.length() > 0)
              answer.setLength(answer.length()-1);
          } else {
            answer.append(s.charAt(i));
          }
        }
      
        System.out.println(answer);
        
	} 
} import java.util.*; util.* java public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      
        String s = sc.next();
        StringBuilder answer = new StringBuilder();
        
        for(int i=0;i < s.length();i++){
          //System.out.println(s.charAt(i));
          
          if (String.valueOf(s.charAt(i)).equals("B")){
            if (answer.length() > 0)
              answer.setLength(answer.length()-1);
          } else {
            answer.append(s.charAt(i));
          }
        }
      
        System.out.println(answer);
        
	} 
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      
        String s = sc.next();
        StringBuilder answer = new StringBuilder();
        
        for(int i=0;i < s.length();i++){
          //System.out.println(s.charAt(i));
          
          if (String.valueOf(s.charAt(i)).equals("B")){
            if (answer.length() > 0)
              answer.setLength(answer.length()-1);
          } else {
            answer.append(s.charAt(i));
          }
        }
      
        System.out.println(answer);
        
	} main {
		Scanner sc = new Scanner(System.in);
      
        String s = sc.next();
        StringBuilder answer = new StringBuilder();
        
        for(int i=0;i < s.length();i++){
          //System.out.println(s.charAt(i));
          
          if (String.valueOf(s.charAt(i)).equals("B")){
            if (answer.length() > 0)
              answer.setLength(answer.length()-1);
          } else {
            answer.append(s.charAt(i));
          }
        }
      
        System.out.println(answer);
        
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc StringBuilder answer = new StringBuilder(); answer new StringBuilder() for(int i=0;i < s.length();i++){
          //System.out.println(s.charAt(i));
          
          if (String.valueOf(s.charAt(i)).equals("B")){
            if (answer.length() > 0)
              answer.setLength(answer.length()-1);
          } else {
            answer.append(s.charAt(i));
          }
        } int i=0; int i=0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
          //System.out.println(s.charAt(i));
          
          if (String.valueOf(s.charAt(i)).equals("B")){
            if (answer.length() > 0)
              answer.setLength(answer.length()-1);
          } else {
            answer.append(s.charAt(i));
          }
        } {
          //System.out.println(s.charAt(i));
          
          if (String.valueOf(s.charAt(i)).equals("B")){
            if (answer.length() > 0)
              answer.setLength(answer.length()-1);
          } else {
            answer.append(s.charAt(i));
          }
        } if (String.valueOf(s.charAt(i)).equals("B")){
            if (answer.length() > 0)
              answer.setLength(answer.length()-1);
          } else {
            answer.append(s.charAt(i));
          } String.valueOf(s.charAt(i)).equals("B") String.valueOf(s.charAt(i)).equals String.valueOf(s.charAt(i)) String.valueOf String s.charAt(i) s.charAt s i "B" {
            if (answer.length() > 0)
              answer.setLength(answer.length()-1);
          } if (answer.length() > 0)
              answer.setLength(answer.length()-1); answer.length() > 0 answer.length() answer.length answer 0 answer.setLength(answer.length()-1) answer.setLength answer answer.length()-1 answer.length() answer.length answer 1 {
            answer.append(s.charAt(i));
          } answer.append(s.charAt(i)) answer.append answer s.charAt(i) s.charAt s i System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      
        String s = sc.next();
        StringBuilder answer = new StringBuilder();
        
        for(int i=0;i < s.length();i++){
          //System.out.println(s.charAt(i));
          
          if (String.valueOf(s.charAt(i)).equals("B")){
            if (answer.length() > 0)
              answer.setLength(answer.length()-1);
          } else {
            answer.append(s.charAt(i));
          }
        }
      
        System.out.println(answer);
        
	} 
} public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      
        String s = sc.next();
        StringBuilder answer = new StringBuilder();
        
        for(int i=0;i < s.length();i++){
          //System.out.println(s.charAt(i));
          
          if (String.valueOf(s.charAt(i)).equals("B")){
            if (answer.length() > 0)
              answer.setLength(answer.length()-1);
          } else {
            answer.append(s.charAt(i));
          }
        }
      
        System.out.println(answer);
        
	} 
} Main
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
      
        String s = sc.next();
        StringBuilder answer = new StringBuilder();
        
        for(int i=0;i < s.length();i++){
          //System.out.println(s.charAt(i));
          
          if (String.valueOf(s.charAt(i)).equals("B")){
            if (answer.length() > 0)
              answer.setLength(answer.length()-1);
          } else {
            answer.append(s.charAt(i));
          }
        }
      
        System.out.println(answer);
        
	} 
}