program main
   
  implicit none
  character(10) :: s,a
  integer :: i,j

  
  read(*,*) s
  a = ""  
  j = 1
  do i = 1, len_trim( s )
    if( s(i:i) == "0" ) then
      a(j:j) = "0"
      j = j + 1
    else if( s(i:i) == "1" ) then
      a(j:j) = "1"
      j = j + 1
    else if( s(i:i) == "B" ) then
      if ( j > 1 )j = j - 1
    end if
  end do
  
  print*, trim( a )


end program main
