        import java.io.*;
        import java.util.*;
        public class Main{
          public static void main(String[] args) throws IOException{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String s = reader.readLine();
            Stack<String> stack = new Stack<String>();
            for(int i=0;i<s.length();i++){
              if(s.charAt(i)=='0'){
                stack.push("0");}
              if(s.charAt(i)=='1'){
                stack.push("1");}
              if(s.charAt(i)=='B' && !stack.isEmpty()){
                stack.pop();}}
            String res = "";
            while(!stack.isEmpty()){
                String p = stack.pop();
              res = p+res;}
            System.out.println(res);}} import java.io.*; io.* java import java.util.*; util.* java public class Main{
          public static void main(String[] args) throws IOException{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String s = reader.readLine();
            Stack<String> stack = new Stack<String>();
            for(int i=0;i<s.length();i++){
              if(s.charAt(i)=='0'){
                stack.push("0");}
              if(s.charAt(i)=='1'){
                stack.push("1");}
              if(s.charAt(i)=='B' && !stack.isEmpty()){
                stack.pop();}}
            String res = "";
            while(!stack.isEmpty()){
                String p = stack.pop();
              res = p+res;}
            System.out.println(res);}} Main public static void main(String[] args) throws IOException{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String s = reader.readLine();
            Stack<String> stack = new Stack<String>();
            for(int i=0;i<s.length();i++){
              if(s.charAt(i)=='0'){
                stack.push("0");}
              if(s.charAt(i)=='1'){
                stack.push("1");}
              if(s.charAt(i)=='B' && !stack.isEmpty()){
                stack.pop();}}
            String res = "";
            while(!stack.isEmpty()){
                String p = stack.pop();
              res = p+res;}
            System.out.println(res);} main {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String s = reader.readLine();
            Stack<String> stack = new Stack<String>();
            for(int i=0;i<s.length();i++){
              if(s.charAt(i)=='0'){
                stack.push("0");}
              if(s.charAt(i)=='1'){
                stack.push("1");}
              if(s.charAt(i)=='B' && !stack.isEmpty()){
                stack.pop();}}
            String res = "";
            while(!stack.isEmpty()){
                String p = stack.pop();
              res = p+res;}
            System.out.println(res);} BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) String s = reader.readLine(); s reader.readLine() reader.readLine reader Stack<String> stack = new Stack<String>(); stack new Stack<String>() for(int i=0;i<s.length();i++){
              if(s.charAt(i)=='0'){
                stack.push("0");}
              if(s.charAt(i)=='1'){
                stack.push("1");}
              if(s.charAt(i)=='B' && !stack.isEmpty()){
                stack.pop();}} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
              if(s.charAt(i)=='0'){
                stack.push("0");}
              if(s.charAt(i)=='1'){
                stack.push("1");}
              if(s.charAt(i)=='B' && !stack.isEmpty()){
                stack.pop();}} {
              if(s.charAt(i)=='0'){
                stack.push("0");}
              if(s.charAt(i)=='1'){
                stack.push("1");}
              if(s.charAt(i)=='B' && !stack.isEmpty()){
                stack.pop();}} if(s.charAt(i)=='0'){
                stack.push("0");} s.charAt(i)=='0' s.charAt(i) s.charAt s i '0' {
                stack.push("0");} stack.push("0") stack.push stack "0" if(s.charAt(i)=='1'){
                stack.push("1");} s.charAt(i)=='1' s.charAt(i) s.charAt s i '1' {
                stack.push("1");} stack.push("1") stack.push stack "1" if(s.charAt(i)=='B' && !stack.isEmpty()){
                stack.pop();} s.charAt(i)=='B' && !stack.isEmpty() s.charAt(i)=='B' s.charAt(i) s.charAt s i 'B' !stack.isEmpty() stack.isEmpty() stack.isEmpty stack {
                stack.pop();} stack.pop() stack.pop stack String res = ""; res "" while(!stack.isEmpty()){
                String p = stack.pop();
              res = p+res;} !stack.isEmpty() stack.isEmpty() stack.isEmpty stack {
                String p = stack.pop();
              res = p+res;} String p = stack.pop(); p stack.pop() stack.pop stack res = p+res res p+res p res System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main{
          public static void main(String[] args) throws IOException{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String s = reader.readLine();
            Stack<String> stack = new Stack<String>();
            for(int i=0;i<s.length();i++){
              if(s.charAt(i)=='0'){
                stack.push("0");}
              if(s.charAt(i)=='1'){
                stack.push("1");}
              if(s.charAt(i)=='B' && !stack.isEmpty()){
                stack.pop();}}
            String res = "";
            while(!stack.isEmpty()){
                String p = stack.pop();
              res = p+res;}
            System.out.println(res);}} public class Main{
          public static void main(String[] args) throws IOException{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String s = reader.readLine();
            Stack<String> stack = new Stack<String>();
            for(int i=0;i<s.length();i++){
              if(s.charAt(i)=='0'){
                stack.push("0");}
              if(s.charAt(i)=='1'){
                stack.push("1");}
              if(s.charAt(i)=='B' && !stack.isEmpty()){
                stack.pop();}}
            String res = "";
            while(!stack.isEmpty()){
                String p = stack.pop();
              res = p+res;}
            System.out.println(res);}} Main
        import java.io.*;
        import java.util.*;
        public class Main{
          public static void main(String[] args) throws IOException{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String s = reader.readLine();
            Stack<String> stack = new Stack<String>();
            for(int i=0;i<s.length();i++){
              if(s.charAt(i)=='0'){
                stack.push("0");}
              if(s.charAt(i)=='1'){
                stack.push("1");}
              if(s.charAt(i)=='B' && !stack.isEmpty()){
                stack.pop();}}
            String res = "";
            while(!stack.isEmpty()){
                String p = stack.pop();
              res = p+res;}
            System.out.println(res);}}