object Main {

  def main(args: Array[String]): Unit = {
    import scala.io.StdIn._
    val s = readLine()
    val stack = scala.collection.mutable.Stack[Char]()
    s foreach {
      case c @ ('0' | '1') => stack.push(c)
      case 'B' => if (stack.nonEmpty) stack.pop()
    }
    println(stack.reverse.mkString)
  }

}
