method to reverse each word in a string