Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Run-length-encoding/Ring/run-length-encoding.ring
Normal file
27
Task/Run-length-encoding/Ring/run-length-encoding.ring
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Project : Run-length encoding
|
||||
|
||||
load "stdlib.ring"
|
||||
test = "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW"
|
||||
num = 0
|
||||
nr = 0
|
||||
decode = newlist(7,2)
|
||||
for n = 1 to len(test) - 1
|
||||
if test[n] = test[n+1]
|
||||
num = num + 1
|
||||
else
|
||||
nr = nr + 1
|
||||
decode[nr][1] = (num + 1)
|
||||
decode[nr][2] = test[n]
|
||||
see "" + (num + 1) + test[n]
|
||||
num = 0
|
||||
ok
|
||||
next
|
||||
see "" + (num + 1) + test[n]
|
||||
see nl
|
||||
nr = nr + 1
|
||||
decode[nr][1] = (num + 1)
|
||||
decode[nr][2] = test[n]
|
||||
for n = 1 to len(decode)
|
||||
dec = copy(decode[n][2], decode[n][1])
|
||||
see dec
|
||||
next
|
||||
Loading…
Add table
Add a link
Reference in a new issue