It can also be done with regular expressions and the replaceAll() method of String class, if you're somewhat familliar with regular expressions.
Although I have to admit, this regex doesnt preserve punctuation that occurs after a repeated
word i.e.:
"back, back, back," --> "back"
I suspect that if you play around with it a little, that can be fixed too.
[edit: found a bug in my regex]
[ March 25, 2006: Message edited by: Garrett Rowe ]