Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Run-length-encoding/Gambas/run-length-encoding.gambas
Normal file
23
Task/Run-length-encoding/Gambas/run-length-encoding.gambas
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Public Sub Main()
|
||||
Dim sString As String = "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW"
|
||||
Dim siCount As Short = 1
|
||||
Dim siStart As Short = 1
|
||||
Dim sHold As New String[]
|
||||
Dim sTemp As String
|
||||
|
||||
sString &= " "
|
||||
|
||||
Repeat
|
||||
sTemp = Mid(sString, siCount, 1)
|
||||
Do
|
||||
Inc siCount
|
||||
If Mid(sString, siCount, 1) <> sTemp Then Break
|
||||
If siCount = Len(sString) Then Break
|
||||
Loop
|
||||
sHold.add(Str(siCount - siStart) & sTemp)
|
||||
siStart = siCount
|
||||
Until siCount = Len(sString)
|
||||
|
||||
Print sString & gb.NewLine & sHold.Join(", ")
|
||||
|
||||
End
|
||||
Loading…
Add table
Add a link
Reference in a new issue