From 1b823059531c98576922bed631de42bf37545f76 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Tue, 6 Dec 2022 10:22:00 -0500 Subject: Solve day 6 part 1 --- 2022/day06.awk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 2022/day06.awk diff --git a/2022/day06.awk b/2022/day06.awk new file mode 100644 index 0000000..176cd4f --- /dev/null +++ b/2022/day06.awk @@ -0,0 +1,14 @@ +{ + for (i = 1; i < length; i++) { + c1 = c2; + c2 = c3; + c3 = c4; + c4 = substr($1, i, 1); + if (c1 == c2 || c1 == c3 || c1 == c4) continue; + if (c2 == c3 || c2 == c4) continue; + if (c3 == c4) continue; + if (i < 4) continue; + print i; + break; + } +} -- cgit 1.4.1