diff options
author | June McEnroe <june@causal.agency> | 2022-12-06 10:22:00 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2022-12-06 10:22:00 -0500 |
commit | 1b823059531c98576922bed631de42bf37545f76 (patch) | |
tree | 10471cd9113f29f46bff3ed1dd8ad47a6f7c1c8d /2022 | |
parent | Solve day 5 part 2 (diff) | |
download | aoc-1b823059531c98576922bed631de42bf37545f76.tar.gz aoc-1b823059531c98576922bed631de42bf37545f76.zip |
Solve day 6 part 1
Diffstat (limited to '')
-rw-r--r-- | 2022/day06.awk | 14 |
1 files changed, 14 insertions, 0 deletions
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; + } +} |