import java.util.Scanner

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

  val s = sc.next
  
  val stack =
    s.foldLeft( Vector.empty[Char] ){(stack, ch) =>
      ch match{
        case '0' if stack.headOption.contains('1') => stack.tail
        case '0'                                   => ch +: stack
        case '1' if stack.headOption.contains('0') => stack.tail
        case '1'                                   => stack :+ ch
        case _                                     => ch +: stack
      }
  }

  val res = s.length - stack.length

  println(res)
}