import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		List<String> list = new ArrayList<String>();
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'B') {
					if(list.size() > 0) {
						list.remove(list.size() - 1);
					}
			}else {
				list.add(String.valueOf(s.charAt(i)));
			}
		}
		StringBuilder sb = new StringBuilder();
		for(String t : list) {
			sb.append(t);
		}
		System.out.println(sb.toString());
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		List<String> list = new ArrayList<String>();
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'B') {
					if(list.size() > 0) {
						list.remove(list.size() - 1);
					}
			}else {
				list.add(String.valueOf(s.charAt(i)));
			}
		}
		StringBuilder sb = new StringBuilder();
		for(String t : list) {
			sb.append(t);
		}
		System.out.println(sb.toString());
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		List<String> list = new ArrayList<String>();
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'B') {
					if(list.size() > 0) {
						list.remove(list.size() - 1);
					}
			}else {
				list.add(String.valueOf(s.charAt(i)));
			}
		}
		StringBuilder sb = new StringBuilder();
		for(String t : list) {
			sb.append(t);
		}
		System.out.println(sb.toString());
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		List<String> list = new ArrayList<String>();
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'B') {
					if(list.size() > 0) {
						list.remove(list.size() - 1);
					}
			}else {
				list.add(String.valueOf(s.charAt(i)));
			}
		}
		StringBuilder sb = new StringBuilder();
		for(String t : list) {
			sb.append(t);
		}
		System.out.println(sb.toString());
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc sc.close() sc.close sc List<String> list = new ArrayList<String>(); list new ArrayList<String>() for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'B') {
					if(list.size() > 0) {
						list.remove(list.size() - 1);
					}
			}else {
				list.add(String.valueOf(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(list.size() > 0) {
						list.remove(list.size() - 1);
					}
			}else {
				list.add(String.valueOf(s.charAt(i)));
			}
		} {
			if(s.charAt(i) == 'B') {
					if(list.size() > 0) {
						list.remove(list.size() - 1);
					}
			}else {
				list.add(String.valueOf(s.charAt(i)));
			}
		} if(s.charAt(i) == 'B') {
					if(list.size() > 0) {
						list.remove(list.size() - 1);
					}
			}else {
				list.add(String.valueOf(s.charAt(i)));
			} s.charAt(i) == 'B' s.charAt(i) s.charAt s i 'B' {
					if(list.size() > 0) {
						list.remove(list.size() - 1);
					}
			} if(list.size() > 0) {
						list.remove(list.size() - 1);
					} list.size() > 0 list.size() list.size list 0 {
						list.remove(list.size() - 1);
					} list.remove(list.size() - 1) list.remove list list.size() - 1 list.size() list.size list 1 {
				list.add(String.valueOf(s.charAt(i)));
			} list.add(String.valueOf(s.charAt(i))) list.add list String.valueOf(s.charAt(i)) String.valueOf String s.charAt(i) s.charAt s i StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(String t : list) {
			sb.append(t);
		} String t list {
			sb.append(t);
		} {
			sb.append(t);
		} sb.append(t) sb.append sb t 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);
		String s = sc.next();
		sc.close();
		List<String> list = new ArrayList<String>();
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'B') {
					if(list.size() > 0) {
						list.remove(list.size() - 1);
					}
			}else {
				list.add(String.valueOf(s.charAt(i)));
			}
		}
		StringBuilder sb = new StringBuilder();
		for(String t : list) {
			sb.append(t);
		}
		System.out.println(sb.toString());
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		List<String> list = new ArrayList<String>();
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'B') {
					if(list.size() > 0) {
						list.remove(list.size() - 1);
					}
			}else {
				list.add(String.valueOf(s.charAt(i)));
			}
		}
		StringBuilder sb = new StringBuilder();
		for(String t : list) {
			sb.append(t);
		}
		System.out.println(sb.toString());
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		List<String> list = new ArrayList<String>();
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'B') {
					if(list.size() > 0) {
						list.remove(list.size() - 1);
					}
			}else {
				list.add(String.valueOf(s.charAt(i)));
			}
		}
		StringBuilder sb = new StringBuilder();
		for(String t : list) {
			sb.append(t);
		}
		System.out.println(sb.toString());
	}
}