You are viewing a single comment's thread. Return to all comments →
Haskell, admittedly a bit over-the-top but still elegant :-)
module Main where import Control.Monad (replicateM_) solve :: String -> Int solve = length . filter id . (zipWith (==) <*> drop 1) main :: IO () main = readLn >>= flip replicateM_ (getLine >>= putStrLn . show . solve)
Seems like cookies are disabled on this browser, please enable them to open this website
Alternating Characters
You are viewing a single comment's thread. Return to all comments →
Haskell, admittedly a bit over-the-top but still elegant :-)