The problem is as follows:
You are given a dictionary which contains a list of words and has the method .contains() which returns a boolean indicating if the word is in the dictionary or not. The actual implementation of the dictionary doesn´t matter for the problem.
The input is a string of words which all spaces are removed and contains words in a dictionary. However, it may also contain characters which aren´t found in the dictionary. The output must be a String with the words separated by a space and any word that is not found in the dictionary must be joined with a word which is found in the dictionary.
For example:
Diccionary = ["hi", "mike", "java"] Input = "HiMikeJava" Output = "Hi Mike Java" Input = "HiMikeLJava" Output = "Hi MikeL Java" Input = "HiMikeLJavaSS" Output = "Hi MikeL JavaSS"
The problem that I find is that the input could contain characters not found in the dictionary. Any help is appreciated.
Note: If you answer in code, please answer in Java since it is the only programming language I know. Thanks.