Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
$ include "seed7_05.s7i";
|
||||
|
||||
const func string: lcs (in string: a, in string: b) is func
|
||||
result
|
||||
var string: lcs is "";
|
||||
local
|
||||
var string: x is "";
|
||||
var string: y is "";
|
||||
begin
|
||||
if a <> "" and b <> "" then
|
||||
if a[length(a)] = b[length(b)] then
|
||||
lcs := lcs(a[.. pred(length(a))], b[.. pred(length(b))]) & str(a[length(a)]);
|
||||
else
|
||||
x := lcs(a, b[.. pred(length(b))]);
|
||||
y := lcs(a[.. pred(length(a))], b);
|
||||
if length(x) > length(y) then
|
||||
lcs := x;
|
||||
else
|
||||
lcs := y;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end func;
|
||||
|
||||
const proc: main is func
|
||||
begin
|
||||
writeln(lcs("thisisatest", "testing123testing"));
|
||||
writeln(lcs("1234", "1224533324"));
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue