
import java.util.*;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < c.length; i++) {
			switch (c[i]) {
			case '0':
				list.add(0);
				break;
			case '1':
				list.add(1);
				break;
			case 'B':
				if (list.size() == 0) {
					break;
				}
				list.remove(list.size() - 1);
			}
		}
		
		for (Integer integer : list) {
			System.out.print(integer);
		}
	}
} import java.util.*; util.* java class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < c.length; i++) {
			switch (c[i]) {
			case '0':
				list.add(0);
				break;
			case '1':
				list.add(1);
				break;
			case 'B':
				if (list.size() == 0) {
					break;
				}
				list.remove(list.size() - 1);
			}
		}
		
		for (Integer integer : list) {
			System.out.print(integer);
		}
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < c.length; i++) {
			switch (c[i]) {
			case '0':
				list.add(0);
				break;
			case '1':
				list.add(1);
				break;
			case 'B':
				if (list.size() == 0) {
					break;
				}
				list.remove(list.size() - 1);
			}
		}
		
		for (Integer integer : list) {
			System.out.print(integer);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < c.length; i++) {
			switch (c[i]) {
			case '0':
				list.add(0);
				break;
			case '1':
				list.add(1);
				break;
			case 'B':
				if (list.size() == 0) {
					break;
				}
				list.remove(list.size() - 1);
			}
		}
		
		for (Integer integer : list) {
			System.out.print(integer);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc char[] c = s.toCharArray(); c s.toCharArray() s.toCharArray s List<Integer> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < c.length; i++) {
			switch (c[i]) {
			case '0':
				list.add(0);
				break;
			case '1':
				list.add(1);
				break;
			case 'B':
				if (list.size() == 0) {
					break;
				}
				list.remove(list.size() - 1);
			}
		} int i = 0; int i = 0; i 0 i < c.length i c.length c c.length i++ i++ i {
			switch (c[i]) {
			case '0':
				list.add(0);
				break;
			case '1':
				list.add(1);
				break;
			case 'B':
				if (list.size() == 0) {
					break;
				}
				list.remove(list.size() - 1);
			}
		} {
			switch (c[i]) {
			case '0':
				list.add(0);
				break;
			case '1':
				list.add(1);
				break;
			case 'B':
				if (list.size() == 0) {
					break;
				}
				list.remove(list.size() - 1);
			}
		} switch (c[i]) {
			case '0':
				list.add(0);
				break;
			case '1':
				list.add(1);
				break;
			case 'B':
				if (list.size() == 0) {
					break;
				}
				list.remove(list.size() - 1);
			} c[i] c i case '0': '0' case '0': list.add(0) list.add list 0 break; case '1': '1' case '1': list.add(1) list.add list 1 break; case 'B': 'B' case 'B': if (list.size() == 0) {
					break;
				} list.size() == 0 list.size() list.size list 0 {
					break;
				} break; list.remove(list.size() - 1) list.remove list list.size() - 1 list.size() list.size list 1 for (Integer integer : list) {
			System.out.print(integer);
		} Integer integer list {
			System.out.print(integer);
		} {
			System.out.print(integer);
		} System.out.print(integer) System.out.print System.out System System.out integer String args[] args

import java.util.*;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < c.length; i++) {
			switch (c[i]) {
			case '0':
				list.add(0);
				break;
			case '1':
				list.add(1);
				break;
			case 'B':
				if (list.size() == 0) {
					break;
				}
				list.remove(list.size() - 1);
			}
		}
		
		for (Integer integer : list) {
			System.out.print(integer);
		}
	}
}