Building a Word count

For this programming assignment, you will read a collection of words and produce a count for the number of times each word occurs in the input. The output should be sorted by word frequency (most common first) and then lexicographically. To simplify things, we will use the readWord method from the annio package to define what a word is. Moreover, the input will end when you read the word "fin."

More specifically, you can use the following loop to read all of the input (you need to add code to add each word that you read to the word count).

    while( true ) {
        String word = theKeyboard.readWord();
        if( word.compareTo( "fin" ) == 0 )  break;
        // process the word
    // now sort the word list, by count and then lexicographically.

For the following input:

this this is test is a test
test fin

You should produce the following output:

3 test
2 is
2 this
1 a

You may find the java documentation for String and Vector useful in completing this assignment.