题号:NC224697
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
You are given

strings, each a permutation of the first

upper-case letters of the alphabet.
String

is a

of string

if and only if it is possible to delete some (possibly zero) characters from the string

to get the string

.
Compute the length of the longest common
of all
strings.
输入描述:
The first line of input contains two integers
and
, where
is the number of strings, and the strings are all permutations of the first
upper-case letters of the alphabet.Each of the next

lines contains a single string

. It is guaranteed that every

contains each of the first

upper-case letters of the alphabet exactly once.
输出描述:
Output a single integer, the length of the longest subsequence that appears in all
strings.
示例2
输入
复制
3 8
HGBDFCAE
ADBGHFCE
HCFGBDAE
示例3
输入
复制
6 8
AHFBGDCE
FABGCEHD
AHDGFBCE
DABHGCFE
ABCHFEDG
DGABHFCE
备注:
