main = do
    st <- getContents
    putStrLn $ show $ ans st

ans :: String -> Int
ans = snd . foldl revnum ('n', -2) 

revnum :: (Char, Int) -> Char -> (Char, Int)
revnum (c,n) newc
    | c == newc = (c,n)
    | otherwise = (newc, n+1)
