Files
advent-of-code/2024/day-4/solution-2.sh

10 lines
199 B
Bash
Raw Normal View History

2024-12-04 20:46:24 +08:00
#!/usr/bin/env bash
2024-12-04 23:08:09 +08:00
sed 's/^A/B/g;s/A$/B/g' input.txt | paste -s -d '' |
2024-12-04 20:46:24 +08:00
perl -lne '
print "$1$4$2$3"
while
2024-12-04 22:15:25 +08:00
/(?<=(.).(.).{138})A(?=.{138}(.).(.))/g
2024-12-04 20:46:24 +08:00
' |
2024-12-04 22:15:25 +08:00
grep -Ec '(SM|MS){2}'