CPE 103 Maps Lab

This is problem 12.25 in the Weiss textbook.

Many companies like to have phone numbers that can be spelled on the phone pad, rather than being random digits. For instance, 1-800-DRWEISS is actually 1-800-379-3477. Also, numbers, such as account numbers can sometimes be more easily remembered when they can be spelled out on a phone pad. For instance, the account number 7378378377, which is hard to remember would be easier to remember if one observes that the word "REQUESTERS" types the same sequence of buttons on a phone pad. This account number is special, because "PERVERTERS" also types the same sequence.

Write a program that reads one word (upper or lower case) per line from standard input. Translate each word into the corresponding phone number. (Note that multiple words may translate into the same phone number). Then determine which of these numbers has the MOST matching words in the file.  Display the number along with the words that it matches. If there are several such numbers, show the results for all of them.

Sample Input Sample Output
DINNERWARE
VELOCIPEDE
TELEPHONES
DECORATORS
REQUESTERS
SNOWFLAKES
UROLOGISTS
PERVERTERS
CHIVALROUS
SPACEWOMEN
TASTEFULLY
THUMBTACKS
BUTTERMILK
CABLEGUY
GLADIATOR
PROGRAMMR
checkbox
avocado

7378378377 perverters requesters
abcdef
cabfde
baadee
sadcad
babedf
padabc
w
x
y

222333 abcdef baadee babedf cabfde
HELLO
MONDAY
NOMFAZ
JELLO
666329 monday nomfaz


If the above problem statement has omitted any requirements, you may make any assumptions you wish about them.

You are to use Maps effectively in your solution.  Your design should separate the input/output from the domain logic.  Don't store the list of input words in your program; put them into a map as you process them.  If you are concatenating the words into a string you are being a brute. Your algorithm should be decomposed into several methods that can be individually unit tested.  Provide both unit and system test results with your submission.