import java.util.*;

public class Main{
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	List<String> list = new ArrayList<String>();
	for ( int i = 0; i < s.length(); i++ ) {
	    char tmp = s.charAt(i);
	    if ( tmp == '0' ) {
		list.add("0");
	    } else if ( tmp == '1' ) {
		list.add("1");
	    } else if ( tmp == 'B' ) {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    }
	}
	for ( Iterator it = list.iterator(); it.hasNext();) {
	    System.out.print(it.next());
	}
	System.out.println();
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	List<String> list = new ArrayList<String>();
	for ( int i = 0; i < s.length(); i++ ) {
	    char tmp = s.charAt(i);
	    if ( tmp == '0' ) {
		list.add("0");
	    } else if ( tmp == '1' ) {
		list.add("1");
	    } else if ( tmp == 'B' ) {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    }
	}
	for ( Iterator it = list.iterator(); it.hasNext();) {
	    System.out.print(it.next());
	}
	System.out.println();
    }
} Main public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	List<String> list = new ArrayList<String>();
	for ( int i = 0; i < s.length(); i++ ) {
	    char tmp = s.charAt(i);
	    if ( tmp == '0' ) {
		list.add("0");
	    } else if ( tmp == '1' ) {
		list.add("1");
	    } else if ( tmp == 'B' ) {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    }
	}
	for ( Iterator it = list.iterator(); it.hasNext();) {
	    System.out.print(it.next());
	}
	System.out.println();
    } main {
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	List<String> list = new ArrayList<String>();
	for ( int i = 0; i < s.length(); i++ ) {
	    char tmp = s.charAt(i);
	    if ( tmp == '0' ) {
		list.add("0");
	    } else if ( tmp == '1' ) {
		list.add("1");
	    } else if ( tmp == 'B' ) {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    }
	}
	for ( Iterator it = list.iterator(); it.hasNext();) {
	    System.out.print(it.next());
	}
	System.out.println();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc List<String> list = new ArrayList<String>(); list new ArrayList<String>() for ( int i = 0; i < s.length(); i++ ) {
	    char tmp = s.charAt(i);
	    if ( tmp == '0' ) {
		list.add("0");
	    } else if ( tmp == '1' ) {
		list.add("1");
	    } else if ( tmp == 'B' ) {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    }
	} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
	    char tmp = s.charAt(i);
	    if ( tmp == '0' ) {
		list.add("0");
	    } else if ( tmp == '1' ) {
		list.add("1");
	    } else if ( tmp == 'B' ) {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    }
	} {
	    char tmp = s.charAt(i);
	    if ( tmp == '0' ) {
		list.add("0");
	    } else if ( tmp == '1' ) {
		list.add("1");
	    } else if ( tmp == 'B' ) {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    }
	} char tmp = s.charAt(i); tmp s.charAt(i) s.charAt s i if ( tmp == '0' ) {
		list.add("0");
	    } else if ( tmp == '1' ) {
		list.add("1");
	    } else if ( tmp == 'B' ) {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    } tmp == '0' tmp '0' {
		list.add("0");
	    } list.add("0") list.add list "0" if ( tmp == '1' ) {
		list.add("1");
	    } else if ( tmp == 'B' ) {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    } tmp == '1' tmp '1' {
		list.add("1");
	    } list.add("1") list.add list "1" if ( tmp == 'B' ) {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    } tmp == 'B' tmp 'B' {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    } if ( !list.isEmpty() ) list.remove(list.size()-1); !list.isEmpty() list.isEmpty() list.isEmpty list list.remove(list.size()-1) list.remove list list.size()-1 list.size() list.size list 1 for ( Iterator it = list.iterator(); it.hasNext();) {
	    System.out.print(it.next());
	} Iterator it = list.iterator(); Iterator it = list.iterator(); it list.iterator() list.iterator list it.hasNext() it.hasNext it {
	    System.out.print(it.next());
	} {
	    System.out.print(it.next());
	} System.out.print(it.next()) System.out.print System.out System System.out it.next() it.next it System.out.println() System.out.println System.out System System.out String[] args args public class Main{
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	List<String> list = new ArrayList<String>();
	for ( int i = 0; i < s.length(); i++ ) {
	    char tmp = s.charAt(i);
	    if ( tmp == '0' ) {
		list.add("0");
	    } else if ( tmp == '1' ) {
		list.add("1");
	    } else if ( tmp == 'B' ) {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    }
	}
	for ( Iterator it = list.iterator(); it.hasNext();) {
	    System.out.print(it.next());
	}
	System.out.println();
    }
} public class Main{
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	List<String> list = new ArrayList<String>();
	for ( int i = 0; i < s.length(); i++ ) {
	    char tmp = s.charAt(i);
	    if ( tmp == '0' ) {
		list.add("0");
	    } else if ( tmp == '1' ) {
		list.add("1");
	    } else if ( tmp == 'B' ) {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    }
	}
	for ( Iterator it = list.iterator(); it.hasNext();) {
	    System.out.print(it.next());
	}
	System.out.println();
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	List<String> list = new ArrayList<String>();
	for ( int i = 0; i < s.length(); i++ ) {
	    char tmp = s.charAt(i);
	    if ( tmp == '0' ) {
		list.add("0");
	    } else if ( tmp == '1' ) {
		list.add("1");
	    } else if ( tmp == 'B' ) {
		if ( !list.isEmpty() ) list.remove(list.size()-1);
	    }
	}
	for ( Iterator it = list.iterator(); it.hasNext();) {
	    System.out.print(it.next());
	}
	System.out.println();
    }
}
