30 lines
971 B
Text
30 lines
971 B
Text
Const numCad = 5
|
|
Data ""
|
|
Data "'If I were two-faced, would I be wearing this one?' --- Abraham Lincoln "
|
|
Data "..1111111111111111111111111111111111111111111111111111111111111117777888"
|
|
Data "I never give 'em hell, I just tell the truth, and they think it's hell. "
|
|
Data " --- Harry S Truman "
|
|
|
|
Dim Shared As String cadIN, cadOUT
|
|
|
|
Sub Collapse
|
|
Dim As String a, b
|
|
If cadIN = "" Then cadOUT = cadIN: Exit Sub
|
|
cadOUT = Space(Len(cadIN))
|
|
a = Left(cadIN,1)
|
|
Mid(cadOUT,1,1) = a
|
|
Dim As Integer txtOUT = 2
|
|
For i As Integer = 2 To Len(cadIN)
|
|
b = Mid(cadIN,i,1)
|
|
If a <> b Then Mid(cadOUT,txtOUT,1) = b: txtOUT += 1: a = b
|
|
Next i
|
|
cadOUT = Left(cadOUT,txtOUT-1)
|
|
End Sub
|
|
|
|
For j As Integer = 1 To numCad
|
|
Read cadIN
|
|
Collapse
|
|
Print " <<<"; cadIN; ">>> (longitud "; Len(cadIN); _
|
|
!")\n se pliega a:\n <<<"; cadOUT; ">>> (longitud "; Len(cadOUT); !")\n"
|
|
Next j
|
|
Sleep
|