It is a common practice in cryptography to remove the spaces from a message
before encoding it to help to disguise its structure.
Even after it is then decoded, we are left with the
problem of putting the spaces back in the message.
Create a class MessageMess that contains a method restore that
takes a String[] dictionary of possible words and
a String message as inputs. It returns the message with single spaces inserted to divide the message into words from the dictionary. If there is more than one way to insert spaces, it returns "AMBIGUOUS!" If there is no way to insert spaces, it returns "IMPOSSIBLE!" The return should never
have any leading or trailing spaces.
|