import scala.collection.mutable

object Main {

  val amari = 1000000007

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val S = sc.next()
    val stack = new mutable.Stack[Char]
    var cnt = 0
    for {
      i <- 0 until S.length
    } {
      val s = S.charAt(i)
      if (stack.isEmpty || s == stack.top) {
        stack.push(s)
      } else  {
        stack.pop()
        cnt = cnt+2
      }
    }
    println(cnt)
  }
}
