import Data.Char import Data.List import Control.Monad main = do d <- readLn cs <- map (\c -> if c=='o' then True else False) . filter isAlpha <$> getContents print (gw2 d cs) gw2 :: Int -> [Bool] -> Int gw2 d cs = maximum [chead, clast, maximum (0:cinter)] where chead = maximum $ map length $ filter head $ group $ replicate d True ++ cs clast = maximum $ map length $ filter head $ group $ cs ++ replicate d True cinter = do i <- [0 .. 14-d] let pat = replicate i False ++ replicate d True ++ replicate (14-(d+i)) False let cs' = zipWith (||) pat cs guard (length (filter id cs') == length (filter id cs) + d) return $ maximum $ (0:) $ map length $ filter head $ group cs'