in reply to removing duplicate letters
It seems like your rule needs some clarification before this problem could be solved. What dictatates that 'fooo' should be collapsed to 'foo', but not 'fo'? What does 'foooo' collapse to? 'foo' or 'fooo'?
--Chris