import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val s: String = sc.next()

    def go(acc: Int, updatedS: String): Int = {
      if (!updatedS.contains("01") & !updatedS.contains("10")) acc
      else {
        val newS = updatedS.split("01").flatMap(_.split("10")).mkString
        go(acc + (updatedS.length - newS.length), newS)
      }
    }
    println(go(0, s))
  }
}
