import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Map;
import java.util.HashMap;

public class Main
{
    String s;
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();

	String ans = "";
	for(int i = 0; i < s.length(); i++) {
	    String c = String.valueOf(s.charAt(i));
	    if(!c.equals("B")) {
		ans += c;
	    } else {
		if(ans.length() > 0)
		    ans = ans.substring(0, ans.length() - 1);
	    }
	}
	
	out(ans);
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	s = sc.next();
    }

    void out()
    {
	
    }
    
    void out(int n)
    {
	System.out.println(n);
    }

    void out(double n)
    {
	System.out.println(n);
    }

    void out(long n)
    {
	System.out.println(n);
    }
    
    void out(char c)
    {
	System.out.print(c);
    }
    
    void out(String s)
    {
	System.out.println(s);
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.Comparator; Comparator java.util import java.util.Map; Map java.util import java.util.HashMap; HashMap java.util public class Main
{
    String s;
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();

	String ans = "";
	for(int i = 0; i < s.length(); i++) {
	    String c = String.valueOf(s.charAt(i));
	    if(!c.equals("B")) {
		ans += c;
	    } else {
		if(ans.length() > 0)
		    ans = ans.substring(0, ans.length() - 1);
	    }
	}
	
	out(ans);
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	s = sc.next();
    }

    void out()
    {
	
    }
    
    void out(int n)
    {
	System.out.println(n);
    }

    void out(double n)
    {
	System.out.println(n);
    }

    void out(long n)
    {
	System.out.println(n);
    }
    
    void out(char c)
    {
	System.out.print(c);
    }
    
    void out(String s)
    {
	System.out.println(s);
    }
} Main String s; s public static void main(String args[])
    {
	new Main().solve();
    } main {
	new Main().solve();
    } new Main().solve() new Main().solve new Main() String args[] args void solve()
    {
	in();

	String ans = "";
	for(int i = 0; i < s.length(); i++) {
	    String c = String.valueOf(s.charAt(i));
	    if(!c.equals("B")) {
		ans += c;
	    } else {
		if(ans.length() > 0)
		    ans = ans.substring(0, ans.length() - 1);
	    }
	}
	
	out(ans);
    } solve {
	in();

	String ans = "";
	for(int i = 0; i < s.length(); i++) {
	    String c = String.valueOf(s.charAt(i));
	    if(!c.equals("B")) {
		ans += c;
	    } else {
		if(ans.length() > 0)
		    ans = ans.substring(0, ans.length() - 1);
	    }
	}
	
	out(ans);
    } in() in String ans = ""; ans "" for(int i = 0; i < s.length(); i++) {
	    String c = String.valueOf(s.charAt(i));
	    if(!c.equals("B")) {
		ans += c;
	    } else {
		if(ans.length() > 0)
		    ans = ans.substring(0, ans.length() - 1);
	    }
	} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
	    String c = String.valueOf(s.charAt(i));
	    if(!c.equals("B")) {
		ans += c;
	    } else {
		if(ans.length() > 0)
		    ans = ans.substring(0, ans.length() - 1);
	    }
	} {
	    String c = String.valueOf(s.charAt(i));
	    if(!c.equals("B")) {
		ans += c;
	    } else {
		if(ans.length() > 0)
		    ans = ans.substring(0, ans.length() - 1);
	    }
	} String c = String.valueOf(s.charAt(i)); c String.valueOf(s.charAt(i)) String.valueOf String s.charAt(i) s.charAt s i if(!c.equals("B")) {
		ans += c;
	    } else {
		if(ans.length() > 0)
		    ans = ans.substring(0, ans.length() - 1);
	    } !c.equals("B") c.equals("B") c.equals c "B" {
		ans += c;
	    } ans += c ans c {
		if(ans.length() > 0)
		    ans = ans.substring(0, ans.length() - 1);
	    } if(ans.length() > 0)
		    ans = ans.substring(0, ans.length() - 1); ans.length() > 0 ans.length() ans.length ans 0 ans = ans.substring(0, ans.length() - 1) ans ans.substring(0, ans.length() - 1) ans.substring ans 0 ans.length() - 1 ans.length() ans.length ans 1 out(ans) out ans void in()
    {
	Scanner sc = new Scanner(System.in);
	s = sc.next();
    } in {
	Scanner sc = new Scanner(System.in);
	s = sc.next();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) s = sc.next() s sc.next() sc.next sc void out()
    {
	
    } out {
	
    } void out(int n)
    {
	System.out.println(n);
    } out {
	System.out.println(n);
    } System.out.println(n) System.out.println System.out System System.out n int n n void out(double n)
    {
	System.out.println(n);
    } out {
	System.out.println(n);
    } System.out.println(n) System.out.println System.out System System.out n double n n void out(long n)
    {
	System.out.println(n);
    } out {
	System.out.println(n);
    } System.out.println(n) System.out.println System.out System System.out n long n n void out(char c)
    {
	System.out.print(c);
    } out {
	System.out.print(c);
    } System.out.print(c) System.out.print System.out System System.out c char c c void out(String s)
    {
	System.out.println(s);
    } out {
	System.out.println(s);
    } System.out.println(s) System.out.println System.out System System.out s String s s public class Main
{
    String s;
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();

	String ans = "";
	for(int i = 0; i < s.length(); i++) {
	    String c = String.valueOf(s.charAt(i));
	    if(!c.equals("B")) {
		ans += c;
	    } else {
		if(ans.length() > 0)
		    ans = ans.substring(0, ans.length() - 1);
	    }
	}
	
	out(ans);
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	s = sc.next();
    }

    void out()
    {
	
    }
    
    void out(int n)
    {
	System.out.println(n);
    }

    void out(double n)
    {
	System.out.println(n);
    }

    void out(long n)
    {
	System.out.println(n);
    }
    
    void out(char c)
    {
	System.out.print(c);
    }
    
    void out(String s)
    {
	System.out.println(s);
    }
} public class Main
{
    String s;
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();

	String ans = "";
	for(int i = 0; i < s.length(); i++) {
	    String c = String.valueOf(s.charAt(i));
	    if(!c.equals("B")) {
		ans += c;
	    } else {
		if(ans.length() > 0)
		    ans = ans.substring(0, ans.length() - 1);
	    }
	}
	
	out(ans);
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	s = sc.next();
    }

    void out()
    {
	
    }
    
    void out(int n)
    {
	System.out.println(n);
    }

    void out(double n)
    {
	System.out.println(n);
    }

    void out(long n)
    {
	System.out.println(n);
    }
    
    void out(char c)
    {
	System.out.print(c);
    }
    
    void out(String s)
    {
	System.out.println(s);
    }
} Main
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Map;
import java.util.HashMap;

public class Main
{
    String s;
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();

	String ans = "";
	for(int i = 0; i < s.length(); i++) {
	    String c = String.valueOf(s.charAt(i));
	    if(!c.equals("B")) {
		ans += c;
	    } else {
		if(ans.length() > 0)
		    ans = ans.substring(0, ans.length() - 1);
	    }
	}
	
	out(ans);
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	s = sc.next();
    }

    void out()
    {
	
    }
    
    void out(int n)
    {
	System.out.println(n);
    }

    void out(double n)
    {
	System.out.println(n);
    }

    void out(long n)
    {
	System.out.println(n);
    }
    
    void out(char c)
    {
	System.out.print(c);
    }
    
    void out(String s)
    {
	System.out.println(s);
    }
}
