import Foundation

let input_line = readLine()!

// #1
var characters = Array(input_line.characters)
var count = characters.count
var result = ""
for i in 0..<count {
  switch characters[i] {
    case "0":
    result += "0"
    case "1":
    result += "1"
    case "B":
    if result.characters.count > 0 {
      result = result.substringToIndex(result.endIndex.advancedBy(-1))
    }
    default: break
  }
}
print(result)