2023-07-01 11:58:00 -04:00
|
|
|
sub LCS$(a$, b$)
|
2024-10-16 18:07:41 -07:00
|
|
|
if len(a$) = 0 or len(b$) = 0 return
|
2023-07-01 11:58:00 -04:00
|
|
|
while len(b$)
|
|
|
|
|
for j = len(b$) to 1 step -1
|
2024-10-16 18:07:41 -07:00
|
|
|
if instr(a$, left$(b$, j)) return left$(b$, j)
|
2023-07-01 11:58:00 -04:00
|
|
|
next j
|
|
|
|
|
b$ = mid$(b$, 2)
|
|
|
|
|
wend
|
|
|
|
|
end sub
|
|
|
|
|
|
|
|
|
|
print LCS$("thisisatest", "testing123testing")
|
|
|
|
|
end
|