Option Strict On
Imports System.Console
Imports System.Collections.Generic

Module Program
    Sub Main()
        Dim s As String = NextString()
        Dim ans As New List(Of String)

        For Each v As Char In s
            If v = "B"c Then
                If ans.Count <> 0 Then
                    ans.RemoveAt(ans.Count - 1)
                End If
            Else
                ans.Add(v)
            End If
        Next

        WriteLine(String.Join("", ans))
    End Sub

    Function NextString() As String
        Dim result As New List(Of String)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return String.Join("", result)
    End Function

End Module
