#P2592. Candidate superkey
Candidate superkey
Problem Description
A database table consists of a set of columns called attributes, and a set of rows called entries. A superkey is a set of attributes such that each entry's values for those attributes forms a unique ordered set. That is, for any superkey, each pair of entries differs in at least one of the attributes contained within the superkey. A candidate superkey is a superkey such that no proper subset of its attributes forms a superkey. (A proper subset of a superkey is a set of attributes that is formed by removing one or more attributes from the superkey.)
Input
The input file contains several test cases. Each test case begins with two integers n and m ( 2<=n<=30, 1<=m<=10 ), which indicate the size of the table. Then n lines follow, each line contains m uppercase letters ('A'-'Z') to represent one entry.
Output
For each case, output the number of candidate superkeys of the table.
2 3
ABC
ABC
2 1
A
B
3 3
ABC
ACD
BBE
0
1
2