day 24 optimize
[aoc_eblake.git] / 2018 / day5a.sh
blob410d00618d063dc01c5cd7108ec3d475b64936ec
1 read line < ${1-/dev/null}
2 printf "Starting with %d characters\n" ${#line}
3 adj=$line
4 line+=aA
5 while [[ $line != $adj ]]; do
6 line=$adj
7 for l in {a..z}; do
8 eval adj=\${adj//$l${l^}}
9 eval adj=\${adj//${l^}$l}
10 done
11 done
12 printf "Ended with %d characters\n" ${#line}