Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
string 0;
|
||||
|
||||
proc LCS(SA, SB, Beg, End);
|
||||
char SA, SB;
|
||||
int Beg, End;
|
||||
int APos, BPos, Len;
|
||||
[Beg(0):= 0; End(0):= 0; Len:= 0;
|
||||
APos:= 0;
|
||||
while SA(APos) # 0 do
|
||||
[BPos:= 0;
|
||||
while SB(BPos) # 0 do
|
||||
[if SA(APos) = SB(BPos) then
|
||||
[Len:= 1;
|
||||
while SA(APos+Len) # 0 and SB(BPos+Len) # 0 and
|
||||
SA(APos+Len) = SB(BPos+Len) do Len:= Len+1;
|
||||
];
|
||||
if Len > End(0) - Beg(0) then
|
||||
[Beg(0):= SA + APos;
|
||||
End(0):= Beg(0) + Len;
|
||||
Len:= 0;
|
||||
];
|
||||
BPos:= BPos+1;
|
||||
];
|
||||
APos:= APos+1;
|
||||
];
|
||||
];
|
||||
|
||||
char S1, S2, It;
|
||||
int Beg, End;
|
||||
[S1:= "thisisatest";
|
||||
S2:= "testing123testing";
|
||||
LCS(S1, S2, @Beg, @End);
|
||||
for It:= Beg to End-1 do
|
||||
ChOut(0, It(0));
|
||||
CrLf(0);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue