See the assignment turn-in page (last modified on 22 September 2009) for instructions on turning in your assignment.
The absolute deadline for turning-in Assignment 3 is Friday, 27 November at 11:30 p.m.. It is not possible to turn-in Assignment 3 after the absolute deadline.
Input is read from std-in and is a sequence of n ≥ 0 string pairs. Each string is a single word (that is, a word with no internal space characters); case is ignored. Adjacent strings are separated by one or more space characters. Consecutive string pairs are given in ascending alphabetical order on the first string.
Example input:Albert pear Barbara apple Charlie watermelon Donna pear Edgar apple
The total number of fruit in any input list is unknown, but all fruit listed are unique with respect to their starting letter. For example, before an input list is read, it is unknown whether or not the list contains a fruit starting with ‘a’. However, if there is a fruit starting with ‘a’, it is the only fruit on the list that does start with ‘a’.
You may assume that any input read is formatted as described above.
All pairs read should be written to std-out; adjacent strings should be separated by at least one space character. Pairs should be output in ascending alphabetic order by fruit; within a group of pairs having the same fruit, pairs should be written in ascending alphabetic order by name.
Example output:Barbara apple Edgar apple Albert pear Donna pear Charlie watermelon
Your code should be implemented in a package called assignment
. You
should build any data structures you need; relying on Java library data
structures is not allowed.
This page last modified on 26 October 2009. |