ランレングス圧縮
code:test.py
def RLE(S):
N = len(S)
L =
1
for i in range(1, N):
if S
i
== S
i-1
:
L
-1
+= 1
else:
L.append(1)
return L