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
hide comments
sleepntsheep:
20230827 15:36:29
O(nlogn) suffix array TLE, too strict time limit? 

cubyte:
20221123 07:42:29
A good problem for practicing suffix array.


rafi22:
20220527 13:26:45
TLE TLE TLE TLE.... bc gaand maar liya is question ne to 

wonderfulwhale:
20220524 17:49:35
Suffix Automaton O(n) AC 0.27s Last edit: 20220527 13:12:15 

tr_abhishek:
20210513 10:18:33
TLE TLE TLE TLE.... bc gaand maar liya is question ne to 

allenge:
20210508 11:19:16
SuffixAutoMaton O(n) AC 0.04s 

treenipples:
20210223 13:59:03
Prefix hash O(nlog^2n) with vector + sorting passed in 0.77s


sharath1999:
20200804 15:51:03
Suffix automaton worked super quick for me 

Lê Thanh Phú:
20200802 10:06:04
Suffix Array O(nlog^2(n)) AC 0.53s 

grapo_oranges:
20200707 06:35:02
No need for suffix tree, suffix array is enough to solve this problem, also no need for memory optimization in LCP, it get AC easily.. goodluck O(n log n:) 
Added by:  Bin Jin 
Date:  20070924 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 CPP 