import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();
		int check[]=new int[s.length()];
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				check[i]=-1;
				for(int j=i-1;j>=0;j--) {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				}
			}
			else check[i]=0;
		}
		for(int i=0;i<s.length();i++) {
			if(check[i]==0)System.out.print(s.charAt(i));
		}
		System.out.println();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();
		int check[]=new int[s.length()];
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				check[i]=-1;
				for(int j=i-1;j>=0;j--) {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				}
			}
			else check[i]=0;
		}
		for(int i=0;i<s.length();i++) {
			if(check[i]==0)System.out.print(s.charAt(i));
		}
		System.out.println();
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();
		int check[]=new int[s.length()];
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				check[i]=-1;
				for(int j=i-1;j>=0;j--) {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				}
			}
			else check[i]=0;
		}
		for(int i=0;i<s.length();i++) {
			if(check[i]==0)System.out.print(s.charAt(i));
		}
		System.out.println();
	} main {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();
		int check[]=new int[s.length()];
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				check[i]=-1;
				for(int j=i-1;j>=0;j--) {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				}
			}
			else check[i]=0;
		}
		for(int i=0;i<s.length();i++) {
			if(check[i]==0)System.out.print(s.charAt(i));
		}
		System.out.println();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan scan.close() scan.close scan int check[]=new int[s.length()]; check new int[s.length()] s.length() s.length s for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				check[i]=-1;
				for(int j=i-1;j>=0;j--) {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				}
			}
			else check[i]=0;
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			if(s.charAt(i)=='B') {
				check[i]=-1;
				for(int j=i-1;j>=0;j--) {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				}
			}
			else check[i]=0;
		} {
			if(s.charAt(i)=='B') {
				check[i]=-1;
				for(int j=i-1;j>=0;j--) {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				}
			}
			else check[i]=0;
		} if(s.charAt(i)=='B') {
				check[i]=-1;
				for(int j=i-1;j>=0;j--) {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				}
			}
			else check[i]=0; s.charAt(i)=='B' s.charAt(i) s.charAt s i 'B' {
				check[i]=-1;
				for(int j=i-1;j>=0;j--) {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				}
			} check[i]=-1 check[i] check i -1 1 for(int j=i-1;j>=0;j--) {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				} int j=i-1; int j=i-1; j i-1 i 1 j>=0 j 0 j-- j-- j {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				} {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				} if(check[j]==0) {
						check[j]=-1;
						break;
					} check[j]==0 check[j] check j 0 {
						check[j]=-1;
						break;
					} check[j]=-1 check[j] check j -1 1 break; check[i]=0 check[i] check i 0 for(int i=0;i<s.length();i++) {
			if(check[i]==0)System.out.print(s.charAt(i));
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			if(check[i]==0)System.out.print(s.charAt(i));
		} {
			if(check[i]==0)System.out.print(s.charAt(i));
		} if(check[i]==0)System.out.print(s.charAt(i)); check[i]==0 check[i] check i 0 System.out.print(s.charAt(i)) System.out.print System.out System System.out s.charAt(i) s.charAt s i System.out.println() System.out.println System.out System System.out String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();
		int check[]=new int[s.length()];
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				check[i]=-1;
				for(int j=i-1;j>=0;j--) {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				}
			}
			else check[i]=0;
		}
		for(int i=0;i<s.length();i++) {
			if(check[i]==0)System.out.print(s.charAt(i));
		}
		System.out.println();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();
		int check[]=new int[s.length()];
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				check[i]=-1;
				for(int j=i-1;j>=0;j--) {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				}
			}
			else check[i]=0;
		}
		for(int i=0;i<s.length();i++) {
			if(check[i]==0)System.out.print(s.charAt(i));
		}
		System.out.println();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();
		int check[]=new int[s.length()];
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				check[i]=-1;
				for(int j=i-1;j>=0;j--) {
					if(check[j]==0) {
						check[j]=-1;
						break;
					}
				}
			}
			else check[i]=0;
		}
		for(int i=0;i<s.length();i++) {
			if(check[i]==0)System.out.print(s.charAt(i));
		}
		System.out.println();
	}
}