completed and tested capWord fucntcion