Method of encoding data to minimize the number of codewords - 6118904