Remove duplicates from a string