object Main extends App {
  var str = io.StdIn.readLine()
  val regex = "BW"
  val newStr = "WB"
  var cnt = 0
  var continue = true
  while (continue) {
    if (str.indexOf(regex) == -1) {
      continue = false
    } else {
      str = str.replaceFirst(regex, newStr)
      cnt +=1
    }
  }
  println(cnt)
}
