#K74292. Maximum Team Size
Maximum Team Size
Maximum Team Size
You are given T test cases. For each test case, you are provided with the information of N participants. Each participant speaks one or more languages. The languages for each participant are given as space-separated strings.
Your task is to determine the maximum team size such that every distinct language spoken by any of the participants is represented by at least one member in the team. Essentially, the answer for each test case is the total number of distinct languages spoken by the participants.
The answer is computed by simply counting the distinct words (languages) across the given participant language lists.
inputFormat
The first line of input contains an integer T denoting the number of test cases.
For each test case, the first line contains an integer N denoting the number of participants. This is followed by N lines, each line containing a non-empty string representing the languages spoken by a participant. The languages in each line are given as space-separated words.
Note: It is guaranteed that the input is provided via standard input (stdin).
outputFormat
For each test case, print a single line containing one integer — the maximum team size, which is equal to the number of distinct languages spoken among the participants.
Note: The output should be printed to standard output (stdout).
## sample1
1
english
1
</p>