logo AlgoBeat OnlineJudge
登录 注册

#208810. [ICPC 2022 Xi'an R] Perfect Word

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

You are given strings and required to find the length of the longest perfect word.

A string is called a perfect word, if and only if every non-empty substring of appears in the given strings.

A string is called a substring of if and only if it can be obtained by removing several (possibly zero) characters from the beginning or end of .

输入格式

The first line contains a single integer ().

Each of the next lines contains a string consisting of lowercase English letters.

It is guaranteed that the total length of the given strings is no more than .

输出格式

Output an integer, representing the length of the longest perfect word.

样例

样例输入 1

4
a
t
b
ab

样例输出 1

2

数据范围与提示

Source: The 2022 ICPC Asia Xi'an Regional Contest Problem G.

Author: MonkeyKing.