Problem Statement  
There are several unmarried men and women living in a society where marriage is defined as either one husband with one or more wives, or one wife with one or more husbands. You are given a String[] preferences. The jth character of the ith element of preferences is '1' (one) if the ith man and the jth woman are willing to be part of the same marriage, and '0' (zero) otherwise. Your task is to group these people into the minimum possible number of marriages. Each person must be a member of exactly one marriage, and each marriage must contain only willing members. Return the number of marriages, or 1 if this is not possible.  
Definition  
 
Constraints  
  preferences will contain between 1 and 12 elements, inclusive.  
  The length of each element of preferences will be betwen 1 and 12, inclusive.  
  All elements of preferences will be of the same length.  
  Each element of preferences will contain only '0' (zeroes) and '1' (ones).  
Examples  
0)  
 
1)  
 
2)  
 
3)  
 
4)  
