The Public Relations Office is looking for an easier way to compile the information for their Black Book, a listing of all faculty members. Currently, each department types up a list of their faculty and submits the list to PR. PR then takes all the lists and makes a combined list that is sorted alphabetically by last name. So far they have been doing this task by hand, which takes far more time than the average PR employee has to spare!
What PR is looking for is a program that will take these faculty listings and combine them in a certain format that PR can use for inclusion in the Black Book. All the lists are stored in text files. Each department's file is sorted by last name. The program should take these individually sorted files and combine them into a single sorted file in the format shown below.
The input file will contain, on the first line, a number (between 2 and 12) that reports the number of departments that your program should sort and write to the output file. Following the first line will be a series of sets of lines. The first line of each set contains a department title, and following lines contain the data to be sorted.
The information reported is in this order: Title, First Name, Last Name, Street Address, Home Phone, Work Phone, and Campus Mailbox. The information is delimited with commas.
A blank line separates two sets of lines. There are the same number of department titles and sets of data as the number on the first line reports.
The format of each record held in the output file should be as follows:
----------------------------------------
<Title> <FirstName> <LastName>
<HomeAddress>
Department: <Department>
Home Phone: <HomePhone>
Work Phone: <WorkPhone>
Campus Box: <CampusBox>
The dashed line should be shown at the top of each record. The characters "<" and ">" show where a field should be placed. Please pay attention to spacing.
You may assume that all input files will be in the proper syntax, with no extra spaces. PR therefore expects that the data they are requesting will be in the proper syntax.
2 English Department Dr.,Tom,Davis,Anystreet USA,555-2832,555-2423,823 Mrs.,Jessica,Lembeck,Center Street,555-2543,555-8584,928 Computer Science Mr.,John,Euler,East Pleasure,555-1432,555-2343,126
---------------------------------------- Dr. Tom Davis Anystreet USA Department: English Department Home Phone: 555-2832 Work Phone: 555-2423 Campus Box: 823 ---------------------------------------- Mr. John Euler East Pleasure Department: Computer Science Home Phone: 555-1432 Work Phone: 555-2343 Campus Box: 126 ---------------------------------------- Mrs. Jessica Lembeck Center Street Department: English Department Home Phone: 555-2543 Work Phone: 555-8584 Campus Box: 928