import Data.Bool (bool)

main :: IO ()
main = do
    s <- getLine
    answer $ solve s

type Answer = Int
answer :: Answer -> IO ()
answer = print

solve :: String -> Answer
solve = inner . bool 'W' 'B' . ('B' ==) . head <*> id
  where
    inner x (c : s)
      | x == c    = inner x s
      | otherwise = inner c s + 1
    inner _ []    = 0
