Problem I
Uniform Variation
The Alpine Community Performance Center (ACPC) is doing a promotional photoshoot at a ski resort. To create a sense of balance and inclusion in the photos, the ACPC has decided that the colour of the people’s gear must fit certain criteria.
Each person has four pieces of gear and clothing: a helmet, a jacket, a pair of pants, and skis. Each one of these are one of four colours: red, green, blue, or black.
The ACPC’s criteria is that for each type of gear, either everyone in the photo must wear the same colour or wear all different colours.
For a list of skiers, find the size of the largest group of skiers that can be in the photo while meeting the ACPC’s criteria.
Input
The first line of input contains an integer $n$ ($1 \leq n \leq 50$), the number of skiers.
Each of the next $n$ lines contains four space-separated characters representing the colours of the helmet, jacket, pants, and skis of the $i^\text {th}$ skier. Each character is from the set ${R, G, U, B}$ for red, green, blue, and black, repspectively.
Output
A single integer, the size of the largest group of skiers that can be in the photo.
Sample Input 1 | Sample Output 1 |
---|---|
3 R U B R R U G B U G B B |
2 |
Sample Input 2 | Sample Output 2 |
---|---|
4 U B G G U R G B U U G R U G G U |
4 |