Looping Program 2

Frequently, when you complete a programming project, it is just one step in a larger process. Requests for improvements arrive, or your programme is used by others to produce or modify data, which will then be processed further.

This is exactly what has been done to the collective Info submissions: each student's submission has been compiled and run, and the output from all of these programs has been collected in one large file. Assume that this file lists first the number of submissions overall, and then the information provided by each student on separate lines.  Thus, the overall file has the following format:
678 n = number of students
Smith
Kelly
123456789
yu123456
A
block of data for student 1
Chow
Yun Fat
987654321
hiddendragon
B
block of data for student 2
...
familyName_i
givenNames_i
studentNr_i
amlAccount_i
section_i
block of data for student n

Write a programme which will read this input and print the family name and given names of each student in section B, in the format:

Chow, Yun Fat
You should read all input from the standard input. Normally, this means the keyboard, but you can use redirection to read an input file instead. If your class is called LoopingProgram2 and you want to read in file inputFile.txt, then you should use the command:
% java LoopingProgram2 < info.txt
Note: the angle bracket specifies which direction the data will flow.  Thus, you could also redirect your output to a file rather than have it go to the default (i.e. your computer screen).  For example:
% java HelloWorld > outputFile.txt
To do this program, you may use this sample file which includes the two names above.

Things to think about

What would your programme do... How would these alterations affect the data collection process?