fun main(args: Array<String>) {
  val S = readLine()!!
  var r = ""
  for(s in S){
    when(s){
      '0' -> r += "0"
      '1' -> r += "1"
      else -> r = when(r.length){
        0, 1 -> ""
        else -> r.substring(0, r.length-1)
      }
    }
  }
  println(r)
}