import scala.io.StdIn._

object Main extends App {

  val s = readLine()

  def solve() = {
    val stackAndRemoveCnt = (Array.empty[String], 0)
    s.foldLeft(stackAndRemoveCnt) { case ((stack, removeCnt), char) =>
      val str = char.toString
      if(stack.isEmpty || stack.head == str) {
        (str +: stack, removeCnt)
      } else {
        (stack.drop(1), removeCnt+2)
      }
    }._2
  }
  println(solve())

}

