object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val S = sc.nextLine()
    val stack = scala.collection.mutable.Stack[Char]()
    var count = 0
    S.foreach { next =>
      if (stack.nonEmpty) {
        val head = stack.head
        if (head == next)
          stack.push(next)
        else {
          stack.pop()
          count += 2
        }
      } else stack.push(next)
    }

    println(count)
  }

}
