object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val s = sc.next()
  var ans = ""
  for (c <- s.toList) {
    if (c == 'B') {
      ans = ans.slice(0, ans.length-1)
    } else {
      ans += c
    }
  }
  println(ans)
}
