#P5546. [POI 2000] 公共串

[POI 2000] 公共串

Problem Description

Given several words consisting of lowercase letters, find the length of their longest common substring.

Input Format

The first line of the file is an integer nn, 1n51\le n \le 5, which represents the number of words. The next nn lines each contain one word, consisting only of lowercase letters. The length of each word is at least 11 and at most 20002000.

Output Format

Only one line containing one integer: the length of the longest common substring.

3
abcb
bca
acbc
2

Hint

Translated by ChatGPT 5