object Main {
  def solve(S: String): Int = {
    val N = S.length
    def step(c: Char, i: Int, cnt: Int): Int = i match {
      case `N` => cnt
      case _ =>
        val nextCnt = cnt + (if (S(i) == c) 0 else 1)
        step(S(i), i + 1, nextCnt)
    }
    step(S(0), 1, 1) - 1
  }

  def main(args: Array[String]): Unit = {
    val in = io.Source.fromInputStream(System.in).getLines()
    val S = in.next()
    println(solve(S))
  }
}
