import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val S = sc.next().toCharArray
    var prev = S(0)
    var cnt = 0
    S.foreach(c => {
      if (!c.equals(prev)) {
        prev = c
        cnt += 1
      }
    })
    println(cnt)
  }
}
