mass rename

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2022-12-11 22:46:20 +05:30
parent 1c8b315fea
commit 4200e21bba
11 changed files with 1 additions and 1 deletions

21
day06.hs Normal file
View File

@@ -0,0 +1,21 @@
{-# LANGUAGE OverloadedStrings #-}
import Data.List (nub)
import Lib (readFile')
import Data.Text (Text)
import qualified Data.Text as T
main :: IO ()
main = do
input <- readFile' "day6.in"
putStr "Q1: "
print $ parse 4 input
putStr "Q2: "
print $ parse 14 input
group :: Int -> Text -> [Text]
group _ "" = []
group n xs = T.take n xs : group n (T.tail xs)
parse :: Int -> Text -> Int
parse n = (+ n) . length . takeWhile ((< n) . length) . map (nub . T.unpack) . group n