aoc-2015/jour10/jour10.bs

26 lines
596 B
Text

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$)