Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
RunLengthEncode[input_String]:= (l |-> {First@l, Length@l}) /@ (Split@Characters@input)
|
||||
|
|
@ -0,0 +1 @@
|
|||
RunLengthDecode[input_List]:= ConstantArray @@@ input // Flatten // StringJoin
|
||||
|
|
@ -0,0 +1 @@
|
|||
mystring="WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW";
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
rle = RunLengthEncode[mystring]
|
||||
|
||||
{{"W", 12}, {"B", 1}, {"W", 12}, {"B", 3}, {"W", 24}, {"B", 1}, {"W", 14}}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
mystring == RunLengthDecode[rle]
|
||||
|
||||
True
|
||||
Loading…
Add table
Add a link
Reference in a new issue