Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1 @@
RunLengthEncode[input_String]:= (l |-> {First@l, Length@l}) /@ (Split@Characters@input)

View file

@ -0,0 +1 @@
RunLengthDecode[input_List]:= ConstantArray @@@ input // Flatten // StringJoin

View file

@ -0,0 +1 @@
mystring="WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW";

View file

@ -0,0 +1,3 @@
rle = RunLengthEncode[mystring]
{{"W", 12}, {"B", 1}, {"W", 12}, {"B", 3}, {"W", 24}, {"B", 1}, {"W", 14}}

View file

@ -0,0 +1,3 @@
mystring == RunLengthDecode[rle]
True