Since this sounds a lot like homework, I won't give you any code.
Having said that, it isn't that difficult, just follow the steps, and test to ensure it works after each step:
1) Break your paragraph into separate words, using space and punctuation. Discard all such characters, and convert it all to lower case.
"The quick, brown fox jumps. The dog did not!"
Becomes
the
quick
brown
fox
jumps
the
dog
did
not
2) Sort your words into alphabetical order:
brown
did
dog
fox
jumps
not
quick
the
the
3) Now compare adjacent words: if they are the same, add one to the count.