QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 512 MB Points totaux : 100

#5119. 完美单词

Statistiques

给定 $n$ 个字符串,你需要找到最长的完美单词的长度。

当且仅当字符串 $t$ 的每一个非空子串都出现在给定的字符串中时,称 $t$ 为一个完美单词。

如果字符串 $s$ 可以通过从 $t$ 的开头或结尾删除若干个(可能为零)字符得到,则称 $s$ 是 $t$ 的子串。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 10^5$)。

接下来 $n$ 行,每行包含一个由小写英文字母组成的字符串。

保证所有给定字符串的总长度不超过 $10^5$。

输出格式

输出一个整数,表示最长完美单词的长度。

样例

样例输入 1

4
a
t
b
ab

样例输出 1

2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.