- The user inputs a sentence - words only. Any input other than letters or spaces, including integers and punctuation, should throw an exception: "Sentence must only use letters".
- The output has a pattern, where some words are reversed and others words are normal.
- The pattern starts as a normal word, the next two words are reversed, then the next two words are normal and the pattern continues.
- An example of where the words should be normal and where words reversed is below:
Normal - Reversed - Reversed - Normal - Normal - Reversed - Reversed - Normal ...
She sells Sea shells on the Sea shore
She slles aeS shells on eht aeS shore
- If capital letters are used, they should remain on the letter they were originally posted on.
- Any multiple spaces initially posted on input should be reduced to one space. For example
Programming Puzzles and Code Golfbecomes
Programming selzzuP dna Code Golf
Shortest Code Wins!!