Run-length encoding: Difference between revisions
Content added Content deleted
Line 2,205: | Line 2,205: | ||
<syntaxhighlight lang="easylang"> |
<syntaxhighlight lang="easylang"> |
||
proc |
proc enc in$ . out$ . |
||
out$ = "" |
out$ = "" |
||
for c$ in strchars in$ |
for c$ in strchars in$ |
||
Line 2,220: | Line 2,220: | ||
out$ &= cnt & c0$ |
out$ &= cnt & c0$ |
||
. |
. |
||
proc |
proc dec in$ . out$ . |
||
out$ = "" |
out$ = "" |
||
for h$ in strsplit in$ " " |
for h$ in strsplit in$ " " |
||
Line 2,229: | Line 2,229: | ||
. |
. |
||
. |
. |
||
s$ = input |
|||
print |
print s$ |
||
call |
call enc s$ s$ |
||
print |
print s$ |
||
call dec s$ s$ |
|||
print s$ |
|||
# |
# |
||
input_data |
input_data |
||
WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW |
WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW |
||
12W 1B 12W 3B 24W 1B 14W |
|||
</syntaxhighlight> |
</syntaxhighlight> |