RosettaCodeData/Task/Longest-common-substring/BASIC256/longest-common-substring.basic

13 lines
270 B
Plaintext

function LCS(a, b)
if length(a) = 0 or length(b) = 0 then return ""
while length(b)
for j = length(b) to 1 step -1
if instr(a, left(b, j)) then return left(b, j)
next j
b = mid$(b, 2)
end while
end function
print LCS("thisisatest", "testing123testing")
end