fun main(args: Array<String>) {
    var  inKeys = readLine()?.split("").orEmpty()
    var printStr = ""

    inKeys = inKeys.drop(1).dropLast(1)

    inKeys.forEach{
        if(it == "0"){
            printStr += "0"
        } else if(it == "1"){
            printStr += "1"
        }else if(it == "B"){
            if(printStr != ""){
                printStr = printStr.dropLast(1)
            }
        }
    }

    println(printStr)
}