program ABC043B
    implicit none
    integer(8)::i
    integer(8)::cursor=1
    character(10)::s
    character(10)::out
    read(5,*)s

    do i=1,len_trim(s)
        if(s(i:i)=="0")then
            out(cursor:cursor)="0"
            cursor=cursor+1
        else if(s(i:i)=="1")then
            out(cursor:cursor)="1"
            cursor=cursor+1
        else
            cursor=max(1,cursor-1)
        end if
    end do

    cursor=max(1,cursor-1)

    print'(A)',out(1:cursor)
end program ABC043B