aboutsummaryrefslogtreecommitdiff
path: root/2021/day8/08a.clj
diff options
context:
space:
mode:
authorAria <me@aria.rip>2023-01-02 21:58:56 +0000
committerAria <me@aria.rip>2023-01-02 21:58:56 +0000
commit5eb58ad076f2cd435b11b140820da224b60b73d5 (patch)
tree2a67939595fbf993ff04f69b9cd3f0aa20827d96 /2021/day8/08a.clj
initial commit
Diffstat (limited to '2021/day8/08a.clj')
-rw-r--r--2021/day8/08a.clj12
1 files changed, 12 insertions, 0 deletions
diff --git a/2021/day8/08a.clj b/2021/day8/08a.clj
new file mode 100644
index 0000000..dc261e5
--- /dev/null
+++ b/2021/day8/08a.clj
@@ -0,0 +1,12 @@
+(ns day-8)
+
+(require '[clojure.string :as str])
+
+(def input (as-> (slurp "./input") x
+ (str/split x #"\n")
+ (map (fn [l]
+ (map (fn [p] (str/split (str/trim p) #" ")) (str/split l #"\|"))) x)))
+
+(def onlyOutputs (flatten (map second input)))
+(def knownDigits (filter (fn [xs] (contains? (set '(2 4 3 7)) (count xs))) onlyOutputs))
+(println (count knownDigits))