import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scTmp = new Scanner(System.in);) {

			String sTmp = scTmp.nextLine();
			String sOut = "";
			int iLen = sTmp.length();

			for (int i = 0; i < iLen; i++) {
				char cTmp = sTmp.charAt(i);
				switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				}
			}

			System.out.println(sOut);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		try (Scanner scTmp = new Scanner(System.in);) {

			String sTmp = scTmp.nextLine();
			String sOut = "";
			int iLen = sTmp.length();

			for (int i = 0; i < iLen; i++) {
				char cTmp = sTmp.charAt(i);
				switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				}
			}

			System.out.println(sOut);
		}
	}
} Main public static void main(String[] args) {
		try (Scanner scTmp = new Scanner(System.in);) {

			String sTmp = scTmp.nextLine();
			String sOut = "";
			int iLen = sTmp.length();

			for (int i = 0; i < iLen; i++) {
				char cTmp = sTmp.charAt(i);
				switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				}
			}

			System.out.println(sOut);
		}
	} main {
		try (Scanner scTmp = new Scanner(System.in);) {

			String sTmp = scTmp.nextLine();
			String sOut = "";
			int iLen = sTmp.length();

			for (int i = 0; i < iLen; i++) {
				char cTmp = sTmp.charAt(i);
				switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				}
			}

			System.out.println(sOut);
		}
	} try (Scanner scTmp = new Scanner(System.in);) {

			String sTmp = scTmp.nextLine();
			String sOut = "";
			int iLen = sTmp.length();

			for (int i = 0; i < iLen; i++) {
				char cTmp = sTmp.charAt(i);
				switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				}
			}

			System.out.println(sOut);
		} {

			String sTmp = scTmp.nextLine();
			String sOut = "";
			int iLen = sTmp.length();

			for (int i = 0; i < iLen; i++) {
				char cTmp = sTmp.charAt(i);
				switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				}
			}

			System.out.println(sOut);
		} Scanner scTmp = new Scanner(System.in) Scanner scTmp = new Scanner(System.in) new Scanner(System.in) String sTmp = scTmp.nextLine(); sTmp scTmp.nextLine() scTmp.nextLine scTmp String sOut = ""; sOut "" int iLen = sTmp.length(); iLen sTmp.length() sTmp.length sTmp for (int i = 0; i < iLen; i++) {
				char cTmp = sTmp.charAt(i);
				switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				}
			} int i = 0; int i = 0; i 0 i < iLen i iLen i++ i++ i {
				char cTmp = sTmp.charAt(i);
				switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				}
			} {
				char cTmp = sTmp.charAt(i);
				switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				}
			} char cTmp = sTmp.charAt(i); cTmp sTmp.charAt(i) sTmp.charAt sTmp i switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				} cTmp case '0': '0' case '0': sOut = sOut.concat("0") sOut sOut.concat("0") sOut.concat sOut "0" break; case '1': '1' case '1': sOut = sOut.concat("1") sOut sOut.concat("1") sOut.concat sOut "1" break; case 'B': 'B' case 'B': if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					} sOut.length() > 0 sOut.length() sOut.length sOut 0 {
						sOut = sOut.substring(0, sOut.length() - 1);
					} sOut = sOut.substring(0, sOut.length() - 1) sOut sOut.substring(0, sOut.length() - 1) sOut.substring sOut 0 sOut.length() - 1 sOut.length() sOut.length sOut 1 break; System.out.println(sOut) System.out.println System.out System System.out sOut String[] args args public class Main {

	public static void main(String[] args) {
		try (Scanner scTmp = new Scanner(System.in);) {

			String sTmp = scTmp.nextLine();
			String sOut = "";
			int iLen = sTmp.length();

			for (int i = 0; i < iLen; i++) {
				char cTmp = sTmp.charAt(i);
				switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				}
			}

			System.out.println(sOut);
		}
	}
} public class Main {

	public static void main(String[] args) {
		try (Scanner scTmp = new Scanner(System.in);) {

			String sTmp = scTmp.nextLine();
			String sOut = "";
			int iLen = sTmp.length();

			for (int i = 0; i < iLen; i++) {
				char cTmp = sTmp.charAt(i);
				switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				}
			}

			System.out.println(sOut);
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scTmp = new Scanner(System.in);) {

			String sTmp = scTmp.nextLine();
			String sOut = "";
			int iLen = sTmp.length();

			for (int i = 0; i < iLen; i++) {
				char cTmp = sTmp.charAt(i);
				switch (cTmp) {
				case '0':
					sOut = sOut.concat("0");
					break;
				case '1':
					sOut = sOut.concat("1");
					break;
				case 'B':
					if (sOut.length() > 0) {
						sOut = sOut.substring(0, sOut.length() - 1);
					}
					break;
				}
			}

			System.out.println(sOut);
		}
	}
}
