Phone Book

Description

The public relations office is looking for a way to compile the campus phone book. Currently each department types up a list of their faculty and submits the list to the PR department. PR then takes all of the lists and makes a combined list that is sorted alphabetically by last name. Currently they are doing this task by hand.

Your job is to write a program to automate this process.

Input Specification

All lists are stored in text files. Each department's file is sorted by last name.

There is a master file, MERGER.DAT that reports the number of files on the first line, a number between 2 and 12. The following lines contain a file name and a department name for each department that has submitted a file.

All text fields are delimted by a comma. All files are in the correct format.

The individual input files will sorted by last name and have the format:

Title,Firstname,Lastname,Address,homephone,workphone,campusbox

Output Specification

The output file PHONEBOOK.OUT should contain one entry per peron on the faculty, in the following format.
--------------------
< Title>, < Firstname>, < Lastname>
< Address>
Department: < department>
Home Phone: < homephone>
Work Phone: < workphone>
Campus Box: < campusbox>

Sample Input

MERGER.DAT
2
ENG.LST,English
CS.LST,Computer Science
CS.LST
Mr.,Dan,Bennett,A street Edinboro,111-1111,222-2222,202
Ms.,Trish,Hillman,B street Edinboro,111-2222,333-3333,200
ENG.LST
Mr.,Paul,Anderson,1 Street Edinboro,111-1111,222-2222,101
Mr.,Steve,Clyde,4 Ave Edinboro,222-2222,333-3333,103

Sample Output

--------------------
Mr. Paul Anderson
1 Street Edinboro
Department: English
Home Phone: 111-1111
Work Phone: 222-2222
Campus Box: 101
--------------------
Mr. Dan Bennett
A street Edinboro
Department: Computer Science
Home Phone: 111-1111
Work Phone: 222-2222
Campus Box: 202
--------------------
Mr. Steve Clyde
4 Ave Edinboro
Department: English
Home Phone: 222-2222
Work Phone: 333-3333
Campus Box: 103
--------------------
Ms. Trish Hillman
B street Edinboro
Department: Computer Science
Home Phone: 111-2222
Work Phone: 333-3333
Campus Box: 200

This problem is from the Harding University Programming Contest, 1992.