import scala.io.StdIn

object Main {

  def main(args: Array[String]): Unit = {

    val s = StdIn.readLine().trim

    var cnt = 0

    var prev: Option[Char] = None
    s.foreach { c =>
      prev.foreach { p =>
        if (p != c) { cnt += 1 }
      }
      prev = Some(c)
    }

    println(cnt)
  }
}
