program sample
    implicit none
    character(10)::s,ans
    integer(8) :: i,j,m,n
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) s
    n=len_trim(s)
    ans=''
    m=0
    do i=1,n
        if(s(i:i) .eq. '0')then
            ans=ans(1:m)//'0'
            m=m+1
        elseif(s(i:i) .eq. '1')then
            ans=ans(1:m)//'1'
            m=m+1
        else
            m=m-1
            if(m<=0)then
                m=0
                ans=''
            else
                ans=ans(1:m)
            end if
        endif
    end do
            

  
    write(*,*) ans
  
    stop
end program sample
  

