import io.StdIn.readLine


object Main {

  def main(args: Array[String]): Unit = {
    val s = readLine()
    val res = s.foldLeft((0, s.charAt(0))) { (acc, c) =>
      if (acc._2 != c) (acc._1 + 1, c)
      else acc
    }

    println(res._1)
  }

}
