diff options
Diffstat (limited to '2025/02/puzzles.sh')
| -rw-r--r-- | 2025/02/puzzles.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/2025/02/puzzles.sh b/2025/02/puzzles.sh new file mode 100644 index 0000000..0ad12cc --- /dev/null +++ b/2025/02/puzzles.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# START PART 1 +readonly REGEXP='^([0-9]+)\1$' +# END PART 1 START PART 2 +readonly REGEXP='^([0-9]+)\1+$' +# END PART 2 + +tr ',' '\n' <input | while IFS=- read -r x y +do + seq -f %1.0f $x $y +done | grep -E "$REGEXP" | awk '{ n += $1 } END { print n }' |