2021 ICPC North America Division Championships

Start

2021-04-22 15:30 AKDT

2021 ICPC North America Division Championships

End

2021-04-22 19:00 AKDT
The end is near!
Contest is over.
Not yet started.
Contest is starting in -62 days 22:57:46

Time elapsed

3:30:00

Time remaining

0:00:00

Problem H
Longest Common Substring

Given a list of strings, what is the longest substring common to all of them?

Input

The first line of input contains an integer $n$ ($1 \le n \le 1\, 000$), which is the number of strings that follow.

Each of the next $n$ lines contains a single string $s$ ($1 \le |s| \le 100$) consisting only of lower-case letters.

Output

Output a single integer, which is the length of the longest substring common to all of the input strings.

Sample Input 1 Sample Output 1
5
axabcrwmvd
abcn
tabchwqsl
bvrkabcayna
tyabc
3