Program completed

Fixed error where the iterations stopped before the last sentence by adding a test to see if the iterations has come to the last word in the last sentence.