Index |
The index found near the end of a textbook is an essential feature, and is possibly referenced more frequently than the table of contents. Of course only selected terms appear in the index. In this problem you will create a small index.
A normal index must deal with upper- and lower-case terms, unusual
punctuation, and index terms with multiple words. In this problem index
terms will consist only of single words consisting of sequences of at
most 10 letters and digits, with all letters converted to upper case
in the index. Punctuation preceding or following an index term will be
ignored. No terms will have imbedded punctuation. An index will frequently
have lists of references that exceed the length of a line, but in this
problem that problem will be ignored. Each index term and the list of lines
on which it appears appear as a single separate line in the output.
A normal index identifies the page on which a term appears. To keep the
size of the input for this problem manageable, your index will identify the
line on which a term appears. Lines in the text to be indexed are numbered
sequentially, starting with 1.
empty character of for it An empty line has no characters in it at all (except for the end of line character). No word will have more than ten characters in it. The end of the cases will be followed by another empty line. It follows the empty line ending the text of the last case. Repeat A line A repeat of a word on a line does not result in a repeat of the line number in the index.
Case 1 CHARACTER 2 EMPTY 1, 4 FOR 1 IT 1, 3-4 OF 2-3, 5 Case 2 A 1 LINE 1-2 REPEAT 1