aboutsummaryrefslogtreecommitdiff
path: root/2020/06a.hs
diff options
context:
space:
mode:
Diffstat (limited to '2020/06a.hs')
-rw-r--r--2020/06a.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/2020/06a.hs b/2020/06a.hs
new file mode 100644
index 0000000..33647ed
--- /dev/null
+++ b/2020/06a.hs
@@ -0,0 +1,14 @@
+module Day6A where
+
+import Data.List (delete, nub)
+import Data.List.Split (splitOn)
+import System.Environment (getArgs)
+
+-- Usage: runghc --ghc-arg="-package split" 6a.hs inputs/day6
+main :: IO ()
+main = do
+ args <- getArgs;
+ content <- readFile $ head args;
+
+ print $ sum $ map (length . delete '\n' . nub) $ splitOn "\n\n" content;
+ return (); \ No newline at end of file