RosettaCodeData/Task/Longest-common-substring/J/longest-common-substring-1.j

7 lines
114 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
lcstr=:4 :0
C=. ({.~ 1+$) x=/y
M=. >./ (* * * >. * + (_1&|.)@:|:^:2)^:_ C
N=. >./ M
y {~ (M i. N)-i.-N
)