September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
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 }
|
||||
Loading…
Add table
Add a link
Reference in a new issue