#C4752. Maximum Compatible Spells
Maximum Compatible Spells
Maximum Compatible Spells
You are given an integer n representing the number of spells and n strings where each string represents a spell. Two spells are considered compatible if they do not share any common character, i.e., if for two spells S1 and S2 we have \(S_1 \cap S_2 = \emptyset\). Your task is to select a subset of spells such that every pair of spells in the subset is compatible, and the number of spells chosen is maximized.
Input Format: The input begins with an integer n on the first line, followed by n lines each containing a spell (a string of lowercase letters).
Output Format: Output a single integer representing the maximum number of pairwise compatible spells.
Example:
Input: 4 abc def gh cz</p>Output: 3
inputFormat
The first line of input is an integer n representing the number of spells. The next n lines each contain a non-empty string representing a spell.
outputFormat
Print a single integer representing the maximum number of spells that can be selected such that no two spells share any common characters.
## sample4
abc
def
gh
cz
3