import io.{StdIn => in}

object Main extends App {
  val s = in.readLine
  val buf = StringBuilder.newBuilder
  s.foreach( _ match {
    case '0' => buf.append("0")
    case '1' => buf.append("1")
    case 'B' => if(!buf.isEmpty) buf.deleteCharAt(buf.length-1)
  })
  val ans = buf.toString
  println(ans)
}
