#abc249c. C - Just K
C - Just K
Score : points
问题描述
你已获得由小写英文字母组成的 个字符串 。
考虑从 中选择一些字符串。
找出满足以下条件的最大不同字母数:"该字母恰好在所选的 个字符串中出现"。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given strings consisting of lowercase English alphabets.
Consider choosing some number of strings from .
Find the maximum number of distinct alphabets that satisfy the following condition: "the alphabet is contained in exactly of the chosen strings."
Constraints
- and are integers.
- is a non-empty string consisting of lowercase English alphabets.
- For each integer such that , does not contain two or more same alphabets.
- If , then .
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4 2
abi
aef
bc
acg
Sample Output 1
3
When , and are chosen, a
,b
, and c
occur in exactly two of the strings.
There is no way to choose strings so that or more alphabets occur in exactly of the strings, so the answer is .
Sample Input 2
2 2
a
b
Sample Output 2
0
You cannot choose the same string more than once.
Sample Input 3
5 2
abpqxyz
az
pq
bc
cy
Sample Output 3
7
update @ 2024/3/10 10:38:42