check str c
          |(length str ) == 1 = c
          |(take 2 str) == "BW" = check (drop 1 str) c+1
          |(take 2 str) == "WB" = check (drop 1 str) c+1
          |otherwise = check (drop 1 str) c

main = do
      n <- getLine

      print((check n 0) )
