LONGCS - Longest Common Substring

题意翻译

有T(1 ≤ T ≤ 20)组数据,每组数据包含K (1 ≤ K ≤ 10)个小写字母字符串。 要求对每一组字符串输出其最长公共子串长度。每一个字符串长度<= 10^4。

题目描述

Substrings are consecutive parts of a string. A problem usually solved with dynamic programming is to find the longest common substring problem is to find the longest string (or strings) that is a substring (or are substrings) of two strings. Your task is to find the length of the longest common substring of K strings.

输入输出格式

输入格式


The first line contains an integer T, the number of test cases (1

输出格式


Output T lines, one for each test case, containing the required sequence, with a blank space between consecutive terms. It is guaranteed that all terms in the sequence are integers.

输入输出样例

输入样例 #1

2
2
aaabbb
bbaabb
3
icode
coder
contest

输出样例 #1

4
2