import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		int nam = s.length();
		StringBuilder sb = new StringBuilder();
		
		for(int i = 0;i < nam ;i++){
		    if(s.charAt(i) == '0'){
		       sb.append('0');
		    }else if(s.charAt(i) == '1'){
		       sb.append('1');
		    }else if(s.charAt(i) == 'B'){
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  }
		}
		System.out.print(sb);
	}
} import java.util.*; util.* java public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		int nam = s.length();
		StringBuilder sb = new StringBuilder();
		
		for(int i = 0;i < nam ;i++){
		    if(s.charAt(i) == '0'){
		       sb.append('0');
		    }else if(s.charAt(i) == '1'){
		       sb.append('1');
		    }else if(s.charAt(i) == 'B'){
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  }
		}
		System.out.print(sb);
	}
} Main public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		int nam = s.length();
		StringBuilder sb = new StringBuilder();
		
		for(int i = 0;i < nam ;i++){
		    if(s.charAt(i) == '0'){
		       sb.append('0');
		    }else if(s.charAt(i) == '1'){
		       sb.append('1');
		    }else if(s.charAt(i) == 'B'){
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  }
		}
		System.out.print(sb);
	} main {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		int nam = s.length();
		StringBuilder sb = new StringBuilder();
		
		for(int i = 0;i < nam ;i++){
		    if(s.charAt(i) == '0'){
		       sb.append('0');
		    }else if(s.charAt(i) == '1'){
		       sb.append('1');
		    }else if(s.charAt(i) == 'B'){
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  }
		}
		System.out.print(sb);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) String s = in.next(); s in.next() in.next in int nam = s.length(); nam s.length() s.length s StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0;i < nam ;i++){
		    if(s.charAt(i) == '0'){
		       sb.append('0');
		    }else if(s.charAt(i) == '1'){
		       sb.append('1');
		    }else if(s.charAt(i) == 'B'){
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  }
		} int i = 0; int i = 0; i 0 i < nam i nam i++ i++ i {
		    if(s.charAt(i) == '0'){
		       sb.append('0');
		    }else if(s.charAt(i) == '1'){
		       sb.append('1');
		    }else if(s.charAt(i) == 'B'){
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  }
		} {
		    if(s.charAt(i) == '0'){
		       sb.append('0');
		    }else if(s.charAt(i) == '1'){
		       sb.append('1');
		    }else if(s.charAt(i) == 'B'){
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  }
		} if(s.charAt(i) == '0'){
		       sb.append('0');
		    }else if(s.charAt(i) == '1'){
		       sb.append('1');
		    }else if(s.charAt(i) == 'B'){
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  } s.charAt(i) == '0' s.charAt(i) s.charAt s i '0' {
		       sb.append('0');
		    } sb.append('0') sb.append sb '0' if(s.charAt(i) == '1'){
		       sb.append('1');
		    }else if(s.charAt(i) == 'B'){
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  } s.charAt(i) == '1' s.charAt(i) s.charAt s i '1' {
		       sb.append('1');
		    } sb.append('1') sb.append sb '1' if(s.charAt(i) == 'B'){
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  } s.charAt(i) == 'B' s.charAt(i) s.charAt s i 'B' {
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  } if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            } sb.length() >= 1 sb.length() sb.length sb 1 {
                sb.setLength(sb.length()-1);
            } sb.setLength(sb.length()-1) sb.setLength sb sb.length()-1 sb.length() sb.length sb 1 System.out.print(sb) System.out.print System.out System System.out sb String[] args args public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		int nam = s.length();
		StringBuilder sb = new StringBuilder();
		
		for(int i = 0;i < nam ;i++){
		    if(s.charAt(i) == '0'){
		       sb.append('0');
		    }else if(s.charAt(i) == '1'){
		       sb.append('1');
		    }else if(s.charAt(i) == 'B'){
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  }
		}
		System.out.print(sb);
	}
} public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		int nam = s.length();
		StringBuilder sb = new StringBuilder();
		
		for(int i = 0;i < nam ;i++){
		    if(s.charAt(i) == '0'){
		       sb.append('0');
		    }else if(s.charAt(i) == '1'){
		       sb.append('1');
		    }else if(s.charAt(i) == 'B'){
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  }
		}
		System.out.print(sb);
	}
} Main
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
		int nam = s.length();
		StringBuilder sb = new StringBuilder();
		
		for(int i = 0;i < nam ;i++){
		    if(s.charAt(i) == '0'){
		       sb.append('0');
		    }else if(s.charAt(i) == '1'){
		       sb.append('1');
		    }else if(s.charAt(i) == 'B'){
		       if (sb.length() >= 1) {
                sb.setLength(sb.length()-1);
            }
		  }
		}
		System.out.print(sb);
	}
}
