Première version (trop lente)

This commit is contained in:
rick 2021-03-09 02:12:18 +01:00
parent 10f6668664
commit 1a4bf80d27
Signed by: Rick
GPG key ID: 2B593F087240EE99

26
jour10/jour10.bs Normal file
View file

@ -0,0 +1,26 @@
basInput$ = "1113222113"
pred$ = ""
act$ = ""
new$ = ""
k = 0
for i = 0 to 40
print i, " / 40"
for j = 1 to len(basInput$) step k
k = 1
act$ = mid$(basInput$, j, 1)
pred$ = act$
while pred$ = act$ and (j + k) < len(basInput$)
pred$ = act$
act$ = mid$(basInput$, j + k, 1)
k = k + 1
if act$ <> pred$ then
k = k - 1
endif
wend
new$ = new$ + str$(k) + pred$
next j
basInput$ = new$
next i
print "La longeur de la chaine finale est ", len(basInput$)