import Data.List

main = interact main'
main' = show . f . head . reverse . lines

first (a, b) = a

f :: String -> Integer
f str =
    first $ foldl' g init str
    where
        g (a, c) n = (a + (if c /= n then 1 else 0), n)
        init = (0, ' ')