September 17th, 2012, 06:26 PM
Java: Breaking Compound Sentences
Sometimes people write compound sentences which have two statements in one sentence.
For example I like you and you like me. I would like you to write a function called
BREAK_COMP that will accept a sentence and if the the sentence is a compound sentence
return a list containing a list for each statement. If the sentence is not a compound sentence
return a list of the sentence within a list.
You can assume the following:
1. AND is the only word that can create compound sentences.
2. Any time that AND is used it is a compound sentence.
3. A compound sentence can only have 1 AND in it.
If I type in (BREAK_COMP '(I like you))it will output ((I LIKE YOU))
You cannot use any String class functions like myString.substring(x, y).
Any help would be appreciated.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!