import scala.io.StdIn

object Main extends App {

  val s = StdIn.readLine()
  
  def loop(s: String, before: String): String = {
    if(s.isEmpty) before
    else {
      val next = s.head match {
        case '0' => before + "0"
        case '1' => before + "1"
        case 'B' if before.length >= 1 => before.init
        case _ => before
      }
      loop(s.tail, next)
    }
  }
  println(loop(s, ""))

}
