Longest common substring: Difference between revisions

Content added Content deleted
(→‎Searching for smaller substrings of a in b: Trimming is not necessary in the C# implementation of the algorithm.)
(→‎{{header|Ruby}}: Added zkl)
Line 205: Line 205:
"test"
"test"
</pre>
</pre>

=={{header|zkl}}==
<lang zkl>fcn lcd(a,b){
if(b.len()<a.len()){ t:=a; a=b; b=t; }
foreach n,m in ([a.len()..1,-1],a.len()){
s:=a[m,n];
if(s.len()==n and b.holds(s)) return(s);
}
}</lang>
<lang zkl>lcd("testing123testing","thisisatest").println();</lang>
{{out}}<pre>test</pre>