aboutsummaryrefslogtreecommitdiff
path: root/2021/day8/08a.clj
diff options
context:
space:
mode:
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))