Files
advent-of-code/2024/day-4/solution-2.sh
2024-12-04 22:15:25 +08:00

10 lines
173 B
Bash

#!/usr/bin/env bash
paste -s -d '' input.txt |
perl -lne '
print "$1$4$2$3"
while
/(?<=(.).(.).{138})A(?=.{138}(.).(.))/g
' |
grep -Ec '(SM|MS){2}'