diff options
-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; + } +} |