Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/String-length/Sed/string-length.sed
Normal file
20
Task/String-length/Sed/string-length.sed
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# create unary numeral (i = 1)
|
||||
s/./i/g
|
||||
:loop
|
||||
# divide by 10 (x = 10)
|
||||
s/i\{10\}/x/g
|
||||
# convert remainder to decimal digit
|
||||
/i/!s/[0-9]*$/0&/
|
||||
s/i\{9\}/9/
|
||||
s/i\{8\}/8/
|
||||
s/i\{7\}/7/
|
||||
s/i\{6\}/6/
|
||||
s/iiiii/5/
|
||||
s/iiii/4/
|
||||
s/iii/3/
|
||||
s/ii/2/
|
||||
s/i/1/
|
||||
# convert quotient (10s) to 1s
|
||||
y/x/i/
|
||||
# start over for the next magnitude (if any)
|
||||
/i/b loop
|
||||
Loading…
Add table
Add a link
Reference in a new issue