 # How to solve this Character Recognition based question?

Description

Character recognition is the conversion of images into text. For now we consider each
character in the picture is a N*M matrix with only zeros and ones, and we need to
recognize K characters. You are to write a program to find minimal number of pixels so
that we can recognize each character.

For example, we have only two characters ‘T’ and ‘L’, and the matrix size is 3*3, we
can think ‘T’ and ‘L’ are

Input

The first line of input is three integers N, M, K (1 <= N, M <= 10, 2 <= K <= 6).
Which represents the size of matrix and number of characters. Then is following K
blocks, which represents the matrix. Notice that each block starts with a blank
line.

Output

You should output the minimum number of pixels, which is the answer.

Sample test case

Input

2 3 2

111

010

100

100

output

1

let us say there are n different characters

then nC2 sets will be there such that each set corresponds to the comparision of 2 matrices of character and will have the indices of the bits that are different in those matrix
and now the task will be to choose a set that will be the answer such that it has atleast one element from each nC2 sets
now while doing this, we will aim for selecting the index first that is common in most of the nC2 sets
Have a look at this solution if you want code for this problem.

//