RosettaCodeData/Task/Look-and-say-sequence/VBScript/look-and-say-sequence-1.vbs
2026-04-30 12:34:36 -04:00

20 lines
336 B
Text

function looksay( n )
dim i
dim accum
dim res
dim c
res = vbnullstring
do
if n = vbnullstring then exit do
accum = 0
c = left( n,1 )
do while left( n, 1 ) = c
accum = accum + 1
n = mid(n,2)
loop
if accum > 0 then
res = res & accum & c
end if
loop
looksay = res
end function