You work for an insurance company and your group handles the saving and
archiving of all customer correspondence. Each piece of correspondence (letter,
FAX, e-mail message, etc.) is scanned and/or saved into a scanning system that
archives the document into a database. Because your company has so many saved
index of saved documents was created to find each document quickly.
The layout of the index file is as follows. Fields are separated from each
other by single colons, lines are separated by newline characters,
and the file is stored as simple text.
< Document ID > : < Document Type > : < Participant ID > : < Size of
document in bytes > : < Saved Date >
< Document ID > = a 15 digit number (possibly including leading zeroes)
< Document Type > = a 3 digit number representing the type of document
(possibly including leading zeroes)
< Participant ID > = a 9 digit number to identify the participant (possibly
including leading zeroes)
< Size of document in bytes > = size of the document in bytes, with a
maximum size of 100,000 bytes
< Saved Date > = date document was saved in the database, in the following
format: dd-mm-yyyy, where dd is 01-31, mm is 01-12,
and yyyy is a four-digit year
It is possible for the same document to be scanned multiple times; therefore
a given Document ID may appear more than once in the index. Each such
instance is to be treated as a separate document.
Your team is to write a program to read this index file from standard input
and produce a summary report containing the
the number of documents of each Document Type per Participant ID. There will
be no more than 1000 lines in the index.
The report is to contain one line per Participant ID and Document Type.
Each line is to contain the Participant ID, a single space,
the Document Type, a single space, and the number of documents.
There should be no leading or trailing whitespace.
The Participant ID and Document Type are to
appear as they do in the input. The number of documents is to be printed
as an unsigned integer without leading zeroes.
The report is to be sorted by Participant ID
in ascending order, and within Participant ID by Document Type in ascending