32 lines
783 B
Plaintext
32 lines
783 B
Plaintext
Dim Shared As Integer n1 = 1
|
|
|
|
Function reverseString(texto As String) As String
|
|
Dim As Integer x, lt = Len(texto)
|
|
For x = 0 To lt Shr 1 - 1
|
|
Swap texto[x], texto[lt - x - 1]
|
|
Next x
|
|
Return texto
|
|
End Function
|
|
|
|
Sub process(texto As String)
|
|
Dim As Integer c = 0, n2
|
|
Dim As String tmptexto
|
|
|
|
Print "Input stream: "; texto
|
|
Print "Output stream: ";
|
|
Do
|
|
n2 = Instr(texto, Any ",;:.")
|
|
tmptexto = Mid(texto, n1, n2-1)
|
|
Print Iif(c Mod 2 = 0, tmptexto, reverseString(tmptexto)); Mid(texto, n2, 1);
|
|
If Mid(texto, n2, 1) = "." Then Exit Do
|
|
texto = Mid(texto, n2+1, Len(texto))
|
|
c += 1
|
|
Loop
|
|
Print !"\n"
|
|
End Sub
|
|
|
|
process("what,is,the;meaning,of:life.")
|
|
process("we,are;not,in,kansas;any,more.")
|
|
|
|
Sleep
|