13 lines
376 B
Plaintext
13 lines
376 B
Plaintext
PRINT FNlcs("1234", "1224533324")
|
|
PRINT FNlcs("thisisatest", "testing123testing")
|
|
END
|
|
|
|
DEF FNlcs(a$, b$)
|
|
IF a$="" OR b$="" THEN = ""
|
|
IF RIGHT$(a$) = RIGHT$(b$) THEN = FNlcs(LEFT$(a$), LEFT$(b$)) + RIGHT$(a$)
|
|
LOCAL x$, y$
|
|
x$ = FNlcs(a$, LEFT$(b$))
|
|
y$ = FNlcs(LEFT$(a$), b$)
|
|
IF LEN(y$) > LEN(x$) SWAP x$,y$
|
|
= x$
|