import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception{
		
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		String line=in.readLine();
		
		StringBuffer out=new StringBuffer();
		
		for (int i = 0; i < line.length(); i++) {
			char c=line.charAt(i);
			if(c=='B'){
				if(out.length()!=0)
					out.deleteCharAt( out.length()-1);
			}else{
				out.append(c+"");
			}
		}
		
		System.out.println(out);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws Exception{
		
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		String line=in.readLine();
		
		StringBuffer out=new StringBuffer();
		
		for (int i = 0; i < line.length(); i++) {
			char c=line.charAt(i);
			if(c=='B'){
				if(out.length()!=0)
					out.deleteCharAt( out.length()-1);
			}else{
				out.append(c+"");
			}
		}
		
		System.out.println(out);
	}
} Main public static void main(String[] args) throws Exception{
		
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		String line=in.readLine();
		
		StringBuffer out=new StringBuffer();
		
		for (int i = 0; i < line.length(); i++) {
			char c=line.charAt(i);
			if(c=='B'){
				if(out.length()!=0)
					out.deleteCharAt( out.length()-1);
			}else{
				out.append(c+"");
			}
		}
		
		System.out.println(out);
	} main {
		
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		String line=in.readLine();
		
		StringBuffer out=new StringBuffer();
		
		for (int i = 0; i < line.length(); i++) {
			char c=line.charAt(i);
			if(c=='B'){
				if(out.length()!=0)
					out.deleteCharAt( out.length()-1);
			}else{
				out.append(c+"");
			}
		}
		
		System.out.println(out);
	} BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String line=in.readLine(); line in.readLine() in.readLine in StringBuffer out=new StringBuffer(); out new StringBuffer() for (int i = 0; i < line.length(); i++) {
			char c=line.charAt(i);
			if(c=='B'){
				if(out.length()!=0)
					out.deleteCharAt( out.length()-1);
			}else{
				out.append(c+"");
			}
		} int i = 0; int i = 0; i 0 i < line.length() i line.length() line.length line i++ i++ i {
			char c=line.charAt(i);
			if(c=='B'){
				if(out.length()!=0)
					out.deleteCharAt( out.length()-1);
			}else{
				out.append(c+"");
			}
		} {
			char c=line.charAt(i);
			if(c=='B'){
				if(out.length()!=0)
					out.deleteCharAt( out.length()-1);
			}else{
				out.append(c+"");
			}
		} char c=line.charAt(i); c line.charAt(i) line.charAt line i if(c=='B'){
				if(out.length()!=0)
					out.deleteCharAt( out.length()-1);
			}else{
				out.append(c+"");
			} c=='B' c 'B' {
				if(out.length()!=0)
					out.deleteCharAt( out.length()-1);
			} if(out.length()!=0)
					out.deleteCharAt( out.length()-1); out.length()!=0 out.length() out.length out 0 out.deleteCharAt( out.length()-1) out.deleteCharAt out out.length()-1 out.length() out.length out 1 {
				out.append(c+"");
			} out.append(c+"") out.append out c+"" c "" System.out.println(out) System.out.println System.out System System.out out String[] args args public class Main {
	public static void main(String[] args) throws Exception{
		
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		String line=in.readLine();
		
		StringBuffer out=new StringBuffer();
		
		for (int i = 0; i < line.length(); i++) {
			char c=line.charAt(i);
			if(c=='B'){
				if(out.length()!=0)
					out.deleteCharAt( out.length()-1);
			}else{
				out.append(c+"");
			}
		}
		
		System.out.println(out);
	}
} public class Main {
	public static void main(String[] args) throws Exception{
		
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		String line=in.readLine();
		
		StringBuffer out=new StringBuffer();
		
		for (int i = 0; i < line.length(); i++) {
			char c=line.charAt(i);
			if(c=='B'){
				if(out.length()!=0)
					out.deleteCharAt( out.length()-1);
			}else{
				out.append(c+"");
			}
		}
		
		System.out.println(out);
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception{
		
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		String line=in.readLine();
		
		StringBuffer out=new StringBuffer();
		
		for (int i = 0; i < line.length(); i++) {
			char c=line.charAt(i);
			if(c=='B'){
				if(out.length()!=0)
					out.deleteCharAt( out.length()-1);
			}else{
				out.append(c+"");
			}
		}
		
		System.out.println(out);
	}
}
