fun main(args: Array<String>) {
    readLine()!!.toCharArray().fold("") { acc, elm ->
        when (elm) {
            '0', '1' -> acc.plus(elm)
            else -> if (acc.isNotEmpty()) {
                acc.dropLast(1)
            } else {
                acc
            }
        }
    }.let(::println)
}

