SETtextbf{SET}SET is a real-time card game designed by Marsha Falco in 1974 and published by Set Enterprises in 1991. The deck consists of 81 unique cards that vary in four features across three possi
SETtextbf{SET}SET is a real-time card game designed by Marsha Falco in 1974 and published by Set Enterprises in 1991. The deck consists of 81 unique cards that vary in four features across three possibilities for each kind of feature: number of shapes (one, two, or three), shape (diamond, squiggle, oval), shading (solid, striped, or open), and color (red, green, or purple). Each possible combination of features (e.g. a card with [three][striped][green][diamonds]) appears as a card precisely once in the deck. In the game, certain combinations of three cards are said to make up a settextbf{set}set. For each one of the four categories of features --- color, number, shape, and shading --- the three cards must display that feature as a) either all the same, or b) all different. Put another way: For each feature the three cards must avoid having two cards showing one version of the feature and the remaining card showing a different version. For example, [three][solid][red][diamonds] [two][solid][green][squiggles] [one][solid][purple][oval] form a settextbf{set}set, because the shadings of the three cards are all the same, while the numbers, the colors, and the shapes among the three cards are all different. You're given Nmathbf{N}N unique cards, you need to form them into sets. You need to output the maximum number of sets with the given cards, and each card is used at most once.