object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val s = sc.next()
  var ans = ""
  for (c <- s) {
    c match {
      case '0' => ans += "0"
      case '1' => ans += "1"
      case 'B' => ans = ans.init
    }
  }
  println(ans)
}
