You are viewing a single comment's thread. Return to all comments →
Haskell. Not beautiful, but good enough.
module Main where bbs :: String -> Int bbs = go 0 where go acc [] = acc go acc [a] = acc go acc [a, b] = acc go acc (a : b : c : xs) = if a == '0' && b == '1' && c == '0' then go (acc + 1) xs else go acc (b : c : xs) main :: IO () main = getLine >> getLine >>= print . bbs
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Binary String
You are viewing a single comment's thread. Return to all comments →
Haskell. Not beautiful, but good enough.