DeloitteOA #3
Maximum Strings Buildable from at Most K Letters
估计中等可在线判题
Choose at most K letters from a–j (chosen letters can be reused); find the maximum number of the given strings that can be built completely.
This site's standard input/output format and any supplementary ranges follow this problem's description.
输入格式
The first line contains n K (1≤n≤100000, 0≤K≤10); each of the next n lines is a non-empty lowercase string containing only a–j. The total length is ≤200000 (site supplement).
输出格式
Output the maximum number of strings that can be built.
样例 1
输入:
5 3
adf
jjbh
jcg
eijj
adf
输出:
2
样例 2
输入:
2 3
abcd
efgh
输出:
0
样例 3
输入:
5 4
bc
edf
fde
dge
abcd
输出:
3