Introduction
Introduction Statistics Contact Development Disclaimer Help
tadd day 6 part 1 - aoc22 - advent of code 2022 solutions
git clone git://src.adamsgaard.dk/aoc22
Log
Files
Refs
README
---
commit e2290cf47569e979fc024fc8060c156eed4561c5
parent ffafc777abe869365b6e3ee8f0d43ef7ca89ac06
Author: Anders Damsgaard <[email protected]>
Date: Tue, 6 Dec 2022 09:11:17 +0000
add day 6 part 1
Diffstat:
A 6/aoc6 | 13 +++++++++++++
A 6/input | 1 +
A 6/mkfile | 11 +++++++++++
A 6/testinput | 5 +++++
4 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/6/aoc6 b/6/aoc6
t@@ -0,0 +1,13 @@
+#!/bin/awk -f
+{
+ for (i=4; i<=length($0); i++) {
+ m1 = substr($0, i-3, 1)
+ m2 = substr($0, i-2, 1)
+ m3 = substr($0, i-1, 1)
+ m4 = substr($0, i, 1)
+ if (m1 != m2 && m1 != m3 && m1 != m4 && m2 != m3 && m2 != m4 &…
+ print(i)
+ break
+ }
+ }
+}
diff --git a/6/input b/6/input
t@@ -0,0 +1 @@
+bvsvcsssfwwdttzpzqqnjjmbbmpbmpmffnttjllzbblvlvqllcwwqpwwhcclqqhmhbhlbbmtmdmgmp…
diff --git a/6/mkfile b/6/mkfile
t@@ -0,0 +1,11 @@
+run:V:
+ ./aoc6 <input
+
+test:V:
+ # correct answers:
+ # 7
+ # 5
+ # 6
+ # 10
+ # 11
+ ./aoc6 <testinput
diff --git a/6/testinput b/6/testinput
t@@ -0,0 +1,5 @@
+mjqjpqmgbljsphdztnvjfqwrcgsmlb
+bvwbjplbgvbhsrlpgdmjqwftvncz
+nppdvjthqldpwncqszvftbrmjlhg
+nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg
+zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.