-5

Lets suppose a string with no spaces: Input : "putreturnsbetwenparagaphs" Output : put returns between paragraphs

This could get more complex as more words overlap. How to achieve this really fast. If required does spell corrections and splits the word. Think about it.

John Idli
  • 1
  • 2

1 Answers1

0

One problem could be the plural or case of the word. In your example it could be difficult to make a difference between paragraph and paragraphs.

Do you have more information? Are some words in a explicit grammatical form, or could any word of a common dictionary including case, numerus etc. occour?

Mäx Müller
  • 233
  • 1
  • 3
  • 15
  • The easiest way is to come up is backtracking Tries with defined goal or suffix trees. Like max number of words or something. This becomes challenging when you have to correct spellings. – John Idli Aug 12 '13 at 08:48
  • If you have to correct wrong spelling, then you have plenty of work to do. I fear you have to write grammatical rules, to achieve more than one specific goal, otherwise it could be very difficult to cover all possibilities. A combination of grammar and dictionary should be the most reliable solution, but of course it causes the biggest amount of work. – Mäx Müller Aug 12 '13 at 09:18