Record Keeping
InterviewTime limit1sMemory limit128 MB
Count how many times the most repeated unordered group of three cow names appears in N lines.
Problem
Farmer John writes down a record of his cows as they walk into the barn to be milked. Each hour one group of three cows walks in, and Farmer John writes the three names on a single line.
The same group can come back in later hours. Farmer John does not always write the names in the same order, so two lines describe the same group when they list the same three names in any order.
Given the record of hours, count how many times the most frequent group walked into the barn.
Input
The first line contains the number of hours () that Farmer John recorded.
Each of the next lines contains three cow names separated by single spaces. A name uses only the uppercase letters A to Z and is 1 to 10 characters long.
Output
Print the number of times the most frequent group walked into the barn.
Hint
The order of the three names on a line does not change which group the line describes. BESSIE ELSIE MATILDA and MATILDA BESSIE ELSIE are the same group.