import scala.io.StdIn._
object Main{
  def main(args:Array[String]){
    val s = readLine
    val n = s.length
    var cnt = 0
    for(i <- 1 to n-1 if(s(i) != s(i-1))) cnt += 1
    println(cnt)
  }
}
