Remove repeated characters in a string