import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getLine >>= print

solve :: String -> Int
solve = subtract 1 . length . map head . group

