fun main(args: Array<String>) {
    val s = readInputLine().toCharArray()
    val buf = mutableListOf<Int>()
    
    for (c in s) {
        when (c) {
            '0' -> buf.add(0)
            '1' -> buf.add(1)
            else -> if (buf.size > 0) buf.removeAt(buf.lastIndex)
        }
    }
    
    println(buf.joinToString(""))
}

fun readInputLine(): String {
    return readLine()!!
}
