25 lines
404 B
Text
25 lines
404 B
Text
# look and say
|
|
|
|
dim a$(2)
|
|
|
|
i = 0 # input string index
|
|
|
|
a$[i] = "1"
|
|
|
|
print a$[i]
|
|
|
|
for n=1 to 10
|
|
j = 1 - i # output string index
|
|
a$[j] = ""
|
|
k = 1
|
|
while (k <= length(a$[i]))
|
|
k0 = k + 1
|
|
while ((k0 <= length(a$[i])) and (mid(a$[i], k, 1) = mid(a$[i], k0, 1)))
|
|
k0 = k0 + 1
|
|
end while
|
|
a$[j] += string(k0 - k) + mid(a$[i], k, 1)
|
|
k = k0
|
|
end while
|
|
i = j
|
|
print a$[j]
|
|
next n
|