RosettaCodeData/Task/Longest-common-substring/Run-BASIC/longest-common-substring.basic

13 lines
279 B
Plaintext

call LCS "thisisatest", "testing123testing"
end
sub LCS a$, b$
if len(a$) = 0 or len(b$) = 0 then print "": exit sub
while len(b$)
for j = len(b$) to 1 step -1
if instr(a$, left$(b$, j)) then print left$(b$, j): exit sub
next j
b$ = mid$(b$, 2)
wend
end sub