fun main(args: Array<String>) {
    val s = readLine()!!
    var r = ""
    for (i in s.indices) {
        when (s[i]) {
            '0', '1' -> r += s[i]
            else -> if (r.isNotEmpty()) r = r.substring(0, r.lastIndex)
        }
    }
    println(r)
}