You've actually performed what is required already, but you haven't imposed it in all the required areas.

Consider this:
newSentence = sentence + space;
What you're essentially saying is:...