Longest Common Substring
Time limit2sMemory limit512 MB
Given up to 10 lowercase strings, each up to 100,000 characters, find the length of the longest substring shared by all of them.
- Level
Medium7 of 10
- Topics
- String, Binary search, Hash map, String matching
- Solved
- No attempts yet
Problem
Given N strings, find the length of the longest substring that appears in all of them.
Input
The first line gives the number of strings N (2 ≤ N ≤ 10). The next N lines each contain one string. The length of a single string is at most 100,000, and each string consists only of lowercase English letters.
Output
Print the length of the longest substring that appears in all the strings.