File tree 6 files changed +9
-9
lines changed
6 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 1
- * .txt *
1
+ . /* .txt *
2
+ 201 * /
Original file line number Diff line number Diff line change @@ -4,5 +4,5 @@ IFS=$'-:\ \n'
4
4
while read -r m M b c; do x=${c// [^$b]} ; (( ${# x} >= m && ${# x} <= M && ++ ans)) ; done < " ${1:- 2.txt} "
5
5
echo " 2A: $ans "
6
6
ans=0
7
- while read m M b c; do x=${c: m-1: 1} ; y=${c: M-1: 1} ; [[ $x != $y ]] && [[ $b == $x || $b == $y ]] && (( ++ ans)) ; done < ${1:- 2.txt}
7
+ while read -r m M b c; do x=${c: m-1: 1} ; y=${c: M-1: 1} ; [[ $x != " $y " ]] && [[ $b == " $x " || $b == " $y " ]] && (( ++ ans)) ; done < " ${1:- 2.txt} "
8
8
echo " 2B: $ans "
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
X=abcdefghijklmnopqrstuvwxyz; x=$X ; a=0
3
- A=($( sed s/^$/X/ " ${1:- 6.txt} " ) )
4
- A+=(X)
3
+ A=($( sed s/^$/X/ " ${1:- 6.txt} " ) X)
5
4
while read -r -n1 i; do
6
5
[ " $i " = X ] && { (( a+= 26 - ${# x} )) ; x=$X ; }
7
6
x=${x/ $i }
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ while [ ${#I} != 0 ]; do
18
18
C[i]=.$l .; l=
19
19
done
20
20
B=(" ${C[@]} " )
21
- I=${! CHANGE[@ ]}
21
+ I=${! CHANGE[* ]}
22
22
(( ++ round== 1 )) && B=(" ${C[@]// X/ x} " )
23
23
# ((round%10)) || echo "$round: ${#CHANGE[@]}"
24
24
done
@@ -30,9 +30,9 @@ B=(L${A//?/L}L); for i in "${A[@]}"; do B+=(L${i}L); done; B+=($B)
30
30
J=$( seq ${# A} ) ; I=$( seq ${# A[@]} ) ; change=1; round=0
31
31
while [ ${# change} != 0 ]; do
32
32
change=" " ; C=($B ); l=" "
33
- for i in $I ; do # shellcheck disable=SC2034
33
+ for i in $I ; do
34
34
for j in $J ; do
35
- x=${B[i]: j: 1}
35
+ x=${B[i]: $ j: 1}
36
36
[[ " $x " != " L" && " $x " != " X" ]] && l+=$x && continue
37
37
r=${B[i]: j+1} ; r=${r// .} ; R=${B[i]: 0: j} ; R=${R// .}
38
38
s=${R: -1}${r: 0: 1}
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
IFS=$' ,\n '
3
3
input=${1:- 13.txt}
4
- A=($( sed s/x,//g " $input " ) )
4
+ A=($( tr -ds ' x ' ' , ' < " $input " ) )
5
5
time=$A ; min=($A 0)
6
6
for i in " ${A[@]: 1} " ; do
7
7
w=$(( i- time% i))
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ IFS=$' \n' input=${1:-21.txt}
3
3
A=($( grep -o " contains.*" " $input " | grep -o " [a-z]*" | grep -v contains| sort | uniq -c) )
4
4
i=0;
5
5
while read -r a b; do
6
- C[i++]=$( grep -w " $b " " $input " | grep -o " .*(" | grep -o " [a-z]*" | sort | uniq -c | grep -w " $a " | sed " s/[0-9 ]*// " | tr ' \n' ' ' )
6
+ C[i++]=$( grep -w " $b " " $input " | grep -o " .*(" | grep -o " [a-z]*" | sort | uniq -c | grep -w " $a " | tr -ds ' 0-9 \n' ' ' )
7
7
done < <( printf " %s %s\n" " ${A[@]} " )
8
8
9
9
space=" ^[[:space:]]+$"
You can’t perform that action at this time.
0 commit comments