import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		StringBuilder show = new StringBuilder();
		int countB = 0;
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(show.length()>0) {
				show.deleteCharAt(show.length()-1);
				}
			}else {
		show.append(s.charAt(i));
		}
	}
		System.out.println(show);

	}
}
 import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		StringBuilder show = new StringBuilder();
		int countB = 0;
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(show.length()>0) {
				show.deleteCharAt(show.length()-1);
				}
			}else {
		show.append(s.charAt(i));
		}
	}
		System.out.println(show);

	}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		StringBuilder show = new StringBuilder();
		int countB = 0;
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(show.length()>0) {
				show.deleteCharAt(show.length()-1);
				}
			}else {
		show.append(s.charAt(i));
		}
	}
		System.out.println(show);

	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		StringBuilder show = new StringBuilder();
		int countB = 0;
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(show.length()>0) {
				show.deleteCharAt(show.length()-1);
				}
			}else {
		show.append(s.charAt(i));
		}
	}
		System.out.println(show);

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.nextLine(); s scan.nextLine() scan.nextLine scan StringBuilder show = new StringBuilder(); show new StringBuilder() int countB = 0; countB 0 for (int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(show.length()>0) {
				show.deleteCharAt(show.length()-1);
				}
			}else {
		show.append(s.charAt(i));
		}
	} 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') {
				if(show.length()>0) {
				show.deleteCharAt(show.length()-1);
				}
			}else {
		show.append(s.charAt(i));
		}
	} {
			if(s.charAt(i)=='B') {
				if(show.length()>0) {
				show.deleteCharAt(show.length()-1);
				}
			}else {
		show.append(s.charAt(i));
		}
	} if(s.charAt(i)=='B') {
				if(show.length()>0) {
				show.deleteCharAt(show.length()-1);
				}
			}else {
		show.append(s.charAt(i));
		} s.charAt(i)=='B' s.charAt(i) s.charAt s i 'B' {
				if(show.length()>0) {
				show.deleteCharAt(show.length()-1);
				}
			} if(show.length()>0) {
				show.deleteCharAt(show.length()-1);
				} show.length()>0 show.length() show.length show 0 {
				show.deleteCharAt(show.length()-1);
				} show.deleteCharAt(show.length()-1) show.deleteCharAt show show.length()-1 show.length() show.length show 1 {
		show.append(s.charAt(i));
		} show.append(s.charAt(i)) show.append show s.charAt(i) s.charAt s i System.out.println(show) System.out.println System.out System System.out show String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		StringBuilder show = new StringBuilder();
		int countB = 0;
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(show.length()>0) {
				show.deleteCharAt(show.length()-1);
				}
			}else {
		show.append(s.charAt(i));
		}
	}
		System.out.println(show);

	}
} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		StringBuilder show = new StringBuilder();
		int countB = 0;
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(show.length()>0) {
				show.deleteCharAt(show.length()-1);
				}
			}else {
		show.append(s.charAt(i));
		}
	}
		System.out.println(show);

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		StringBuilder show = new StringBuilder();
		int countB = 0;
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)=='B') {
				if(show.length()>0) {
				show.deleteCharAt(show.length()-1);
				}
			}else {
		show.append(s.charAt(i));
		}
	}
		System.out.println(show);

	}
}

