RosettaCodeData/Task/Longest-common-substring/Zkl/longest-common-substring-1.zkl
2023-07-01 13:44:08 -04:00

8 lines
167 B
Text

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()-n+1){
s:=a[m,n];
if(b.holds(s)) return(s);
}
""
}