Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Run-length-encoding/Sed/run-length-encoding-1.sed
Normal file
26
Task/Run-length-encoding/Sed/run-length-encoding-1.sed
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/^$/ b
|
||||
:start
|
||||
/^[0-9]/ b
|
||||
s/^/1/
|
||||
:loop
|
||||
h
|
||||
/^9+([^0-9])\1+/ {
|
||||
s/^(9+).*/0\1/
|
||||
y/09/10/
|
||||
G
|
||||
s/^(.+)\n[0-9]+.(.*)/\1\2/
|
||||
b loop }
|
||||
/^[0-9]*[0-8]([^0-9])\1+/ {
|
||||
s/^[0-9]*([0-8]).*/\1/
|
||||
y/012345678/123456789/
|
||||
G
|
||||
s/^(.)\n([0-9]*)[0-8].(.*)/\2\1\3/
|
||||
b loop }
|
||||
/^[0-9]+9+([^0-9])\1+/ {
|
||||
s/^[0-9]*([0-8]9+).*/\1/
|
||||
y/0123456789/1234567890/
|
||||
G
|
||||
s/^(.+)\n([0-9]*)[0-8]9+.(.*)/\2\1\3/
|
||||
b loop }
|
||||
s/^([0-9]+.)(.*)/\2\1/
|
||||
b start
|
||||
21
Task/Run-length-encoding/Sed/run-length-encoding-2.sed
Normal file
21
Task/Run-length-encoding/Sed/run-length-encoding-2.sed
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/^$/ b
|
||||
:start
|
||||
/^[^0-9]/ b
|
||||
:loop
|
||||
/^1[^0-9]/ {
|
||||
s/^1(.)(\1*)(.*)/\3\1\2/
|
||||
b start }
|
||||
h
|
||||
/^[0-9]*[1-9][^0-9]/ {
|
||||
s/^[0-9]*([1-9]).*/\1/
|
||||
y/123456789/012345678/
|
||||
G
|
||||
s/^([0-8])\n([0-9]*)[1-9]([^0-9])(.*)/\2\1\3\3\4/
|
||||
b loop }
|
||||
/^[0-9]+0[^0-9]/ {
|
||||
s/^[0-9]*([1-9]0+)[^0-9].*/\1/
|
||||
y/0123456789/9012345678/
|
||||
G
|
||||
s/^([0-9]+)\n([0-9]*)[1-9]0+([^0-9])(.*)/\2\1\3\3\4/
|
||||
s/^0+//
|
||||
b loop }
|
||||
8
Task/Run-length-encoding/Sed/run-length-encoding-3.sed
Normal file
8
Task/Run-length-encoding/Sed/run-length-encoding-3.sed
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
sed -rf encode.sed <<< "foo oops"
|
||||
# 1f2o1 2o1p1s
|
||||
|
||||
sed -rf decode.sed <<< "1f2o1 2o1p1s"
|
||||
# foo oops
|
||||
|
||||
(sed -rf decode.sed | sed -rf encode.sed) <<< 1000.
|
||||
# 1000.
|
||||
Loading…
Add table
Add a link
Reference in a new issue