import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ch = sc.next().toCharArray();
		sc.close();

		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < ch.length;i++) {
			if(sb.length()==0&&ch[i]=='B') {
				continue;
			}else if(sb.length() > 0&&ch[i]=='B') {
				sb.deleteCharAt(sb.length()-1);
			}else {
				sb.append(ch[i]);
			}
		}
		System.out.println(sb.toString());
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ch = sc.next().toCharArray();
		sc.close();

		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < ch.length;i++) {
			if(sb.length()==0&&ch[i]=='B') {
				continue;
			}else if(sb.length() > 0&&ch[i]=='B') {
				sb.deleteCharAt(sb.length()-1);
			}else {
				sb.append(ch[i]);
			}
		}
		System.out.println(sb.toString());
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ch = sc.next().toCharArray();
		sc.close();

		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < ch.length;i++) {
			if(sb.length()==0&&ch[i]=='B') {
				continue;
			}else if(sb.length() > 0&&ch[i]=='B') {
				sb.deleteCharAt(sb.length()-1);
			}else {
				sb.append(ch[i]);
			}
		}
		System.out.println(sb.toString());
	} main {
		Scanner sc = new Scanner(System.in);
		char[] ch = sc.next().toCharArray();
		sc.close();

		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < ch.length;i++) {
			if(sb.length()==0&&ch[i]=='B') {
				continue;
			}else if(sb.length() > 0&&ch[i]=='B') {
				sb.deleteCharAt(sb.length()-1);
			}else {
				sb.append(ch[i]);
			}
		}
		System.out.println(sb.toString());
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] ch = sc.next().toCharArray(); ch sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc sc.close() sc.close sc StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0;i < ch.length;i++) {
			if(sb.length()==0&&ch[i]=='B') {
				continue;
			}else if(sb.length() > 0&&ch[i]=='B') {
				sb.deleteCharAt(sb.length()-1);
			}else {
				sb.append(ch[i]);
			}
		} int i = 0; int i = 0; i 0 i < ch.length i ch.length ch ch.length i++ i++ i {
			if(sb.length()==0&&ch[i]=='B') {
				continue;
			}else if(sb.length() > 0&&ch[i]=='B') {
				sb.deleteCharAt(sb.length()-1);
			}else {
				sb.append(ch[i]);
			}
		} {
			if(sb.length()==0&&ch[i]=='B') {
				continue;
			}else if(sb.length() > 0&&ch[i]=='B') {
				sb.deleteCharAt(sb.length()-1);
			}else {
				sb.append(ch[i]);
			}
		} if(sb.length()==0&&ch[i]=='B') {
				continue;
			}else if(sb.length() > 0&&ch[i]=='B') {
				sb.deleteCharAt(sb.length()-1);
			}else {
				sb.append(ch[i]);
			} sb.length()==0&&ch[i]=='B' sb.length()==0 sb.length() sb.length sb 0 ch[i]=='B' ch[i] ch i 'B' {
				continue;
			} continue; if(sb.length() > 0&&ch[i]=='B') {
				sb.deleteCharAt(sb.length()-1);
			}else {
				sb.append(ch[i]);
			} sb.length() > 0&&ch[i]=='B' sb.length() > 0 sb.length() sb.length sb 0 ch[i]=='B' ch[i] ch i 'B' {
				sb.deleteCharAt(sb.length()-1);
			} sb.deleteCharAt(sb.length()-1) sb.deleteCharAt sb sb.length()-1 sb.length() sb.length sb 1 {
				sb.append(ch[i]);
			} sb.append(ch[i]) sb.append sb ch[i] ch i System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ch = sc.next().toCharArray();
		sc.close();

		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < ch.length;i++) {
			if(sb.length()==0&&ch[i]=='B') {
				continue;
			}else if(sb.length() > 0&&ch[i]=='B') {
				sb.deleteCharAt(sb.length()-1);
			}else {
				sb.append(ch[i]);
			}
		}
		System.out.println(sb.toString());
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ch = sc.next().toCharArray();
		sc.close();

		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < ch.length;i++) {
			if(sb.length()==0&&ch[i]=='B') {
				continue;
			}else if(sb.length() > 0&&ch[i]=='B') {
				sb.deleteCharAt(sb.length()-1);
			}else {
				sb.append(ch[i]);
			}
		}
		System.out.println(sb.toString());
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ch = sc.next().toCharArray();
		sc.close();

		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < ch.length;i++) {
			if(sb.length()==0&&ch[i]=='B') {
				continue;
			}else if(sb.length() > 0&&ch[i]=='B') {
				sb.deleteCharAt(sb.length()-1);
			}else {
				sb.append(ch[i]);
			}
		}
		System.out.println(sb.toString());
	}
}