Recursively remove continuous duplicates in a string