LCS  Longest Common Substring
A string is finite sequence of characters over a nonempty finite set Σ.
In this problem, Σ is the set of lowercase letters.
Substring, also called factor, is a consecutive sequence of characters occurrences at least once in a string.
Now your task is simple, for two given strings, find the length of the longest common substring of them.
Here common substring means a substring of two or more strings.
Input
The input contains exactly two lines, each line consists of no more than 250000 lowercase letters, representing a string.
Output
The length of the longest common substring. If such string doesn't exist, print "0" instead.
Example
Input: alsdfkjfjkdsal fdjskalajfkdsla Output: 3
Notice: new testcases added
hide comments
kiwi1995:
20161213 15:18:14
suffix tree with optimization...pheww... 

arun_1997:
20161202 22:08:54
My first implementation of suffix Automaton...


Abdo:
20161103 19:34:26
Weak test cases.


skmonir:
20160826 12:07:51
After reading comments, i thought it won't get AC using O(NlogN) suffix array. But whoa! AC using O(NlogN) + KasaiLCP in 0.14 sec :D Last edit: 20160826 12:09:08 

square1001:
20160726 13:51:47
O(N) suffix array is very efficient!


minhthai:
20160217 05:53:32
O(NlogN) suffix array will not work :( 

Dhawal Harkawat:
20160125 14:13:26
After this, try > http://www.spoj.com/problems/LCS2/


hanif:
20151116 17:27:56
is it possible to solve this problem with rolling hash technique??


(Tjandra Satria Gunawan)(æ›¾æ¯…æ˜†):
20150821 17:53:02
Optimized Suffix Array > TLE


Omer Farukh:
20150314 19:37:04
Is the answer for given testcase correct ?

Added by:  Bin Jin 
Date:  20070924 
Time limit:  0.294s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 CPP 