import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val s = sc.next()

  val list = mutableListOf<Char>()
  var pre = s[0]
  list.add(pre)
  for (i in 1 until s.length) {
    val now = s[i]
    if (now != pre) {
      list.add(now)
    }
    pre = now
  }

  println(list.size - 1)

}
