import java.util.Scanner

fun main (args: Array<String>) {
  val s = Scanner(System.`in`).next()
  val l = mutableListOf<Char>()
  s.forEach { c ->
    when (c) {
      '0', '1' -> { l.add(c) }
      'B' -> {
        if (l.isNotEmpty()) {
          l.removeAt(l.size - 1)
        }
      }
    }
  }
  println(l.joinToString(""))
}