I have this problem to solve
There is an input word from user which has been formed from two different words like
AppleCake or BrownPie
Now we need to develop a program which will take this input and match it against a library of words and break the word into it’s meaningful parts i-e Apple and Cake
Input:AppleCake
Output:This input has two words Apple and Cake
Input: RedGrapesWine
Output: This Input has three words Red, Grapes and Wine
My question is:
How should I start working on this problem?
Can anyone help me with pseudoCode/ Steps towards its solution?
A very simple approach that works only if you have little number of words is to iterate through the words list and try to match word by word.
This is a very basic example (does not handle case, nor multiple occurrences of word or whatever), but it shows you how to do:
This is very simple approach since its time consuming.
Another approach would be to have a Trie and navigate it until you find the right word (should be a better approach).