#P6873. Maximum Number of Test Sentences

    ID: 20080 Type: Default 1000ms 256MiB

Maximum Number of Test Sentences

Maximum Number of Test Sentences

You are given N words. A test sentence is defined as a sentence that contains all lowercase English letters (i.e. the letters \(a, b, c, \dots, z\)). Each word can be used at most once overall, and the order of words within a sentence does not matter (for example, "uvijek jedem sarmu" and "jedem sarmu uvijek" are considered identical).

Your task is to determine the maximum number of test sentences that can be formed using the given words.

Note: You may partition the set of words into several groups. In each group, the union of the letters in the words must be exactly the 26 letters of the English alphabet.

inputFormat

The first line contains a single integer N, the number of words. The following N lines each contain a word consisting only of lowercase English letters.

outputFormat

Output a single integer representing the maximum number of test sentences that can be formed.

sample

1
abcdefghijklmnopqrstuvwxyz
1

</p>