Quote:
How can I can write a code that keep backtracking till find the best matching?
Finding all possible ways to split a string with words in your dictionary, no problem with backtracking.
The concept of "best matching" is far beyond what can do a dictionary, it is still a domain of research. AI with huge amount od sentences is probably the best approach.
Dear Highlander, the way you say "best matching", you will need to use some kind of magic.
You gaol is far beyond reasonable.