object Main extends App {
  val str = io.StdIn.readLine()
  val regex = "BW"
  val newStr = "WB"
  println(rep(str))
  
  def rep(str: String): Int = {
    if (str.indexOf(regex) == -1) {
      0
    } else {
      rep(str.replaceFirst(regex, newStr)) + 1
    }
  }
}
