mostUnique

Category: Line-Based File Processing
Author: Helene Martin and Marty Stepp
Book Chapter: 6.3
Problem: mostUnique
Write a static method named mostUnique that accepts as its parameter a Scanner for an input file. The data in the Scanner represents integer quiz scores separated by spaces. Each class period is on its own line and contains a different number of students. Your method should return the highest number of unique scores given in a single class period. The method should also print the number of unique scores given in each period.

On a given line, repeated scores are always next to each other. 

For example, given a Scanner named input referring to an input file that contains the following text:

     10 10 10 9 9 8 3
     3 3 8 10 9 7 7 6 6
     4 1 9 9 10 7 7 
     10 10 10 10

The call on mostUnique(input) should return 6 and generate the following output:

     Period 1: 4 unique scores
     Period 2: 6 unique scores
     Period 3: 5 unique scores
     Period 4: 1 unique scores

On the first line, there are 4 unique scores: 10, 9, 8 and 3. The second line contains 6 unique scores: 3, 8, 10, 9, 7 and 6. The third line contains 5 unique scores: 4, 1, 9, 10 and 7. The fourth line only has one unique score: 10. The value returned is 6 because it is the highest number of unique scores given in a class period.

Assume that the file exists, that it contains at least one line of data and that each line contains at least one score.