added reverse words in sentence algorithm