import java.util.Scanner

object Main extends App  {
  val sc = new Scanner(System.in)

  val s = sc.next.toCharArray

  val res = s.foldLeft(""){case (str,c) =>
    c match{
      case '0' => str + 0
      case '1' => str + 1
      case 'B' => if(str.length == 0) str else str.substring(0,str.length - 1)
    }
  }

  println(res)

}