26 lines
540 B
Text
26 lines
540 B
Text
|
|
Dim As Integer n, j, k, k0, r
|
||
|
|
Dim As String X(2)
|
||
|
|
Dim As Integer i = 0 ' índice de cadena de entrada
|
||
|
|
X(0) = "1"
|
||
|
|
|
||
|
|
Input "Indica cuantas repeticiones: ", r
|
||
|
|
Print Chr(10) & "Secuencia:"
|
||
|
|
|
||
|
|
Print X(i)
|
||
|
|
For n = 1 To r-1
|
||
|
|
j = 1 - i ' índice de cadena de salida
|
||
|
|
X(j) = ""
|
||
|
|
k = 1
|
||
|
|
While k <= Len(X(i))
|
||
|
|
k0 = k + 1
|
||
|
|
While ((k0 <= Len(X(i))) And (Mid(X(i), k, 1) = Mid(X(i), k0, 1)))
|
||
|
|
k0 += 1
|
||
|
|
Wend
|
||
|
|
X(j) += Str(k0 - k) + Mid(X(i), k, 1)
|
||
|
|
k = k0
|
||
|
|
Wend
|
||
|
|
i = j
|
||
|
|
Print X(j)
|
||
|
|
Next n
|
||
|
|
End
|