Remove Duplicate Characters
Removes duplicate characters from a string while maintaining the order.
- string
- duplicates
- remove
Code
def remove_duplicate_chars(s):
seen = set()
return ''.join(char for char in s if not (char in seen or seen.add(char)))Usage
remove_duplicate_chars('programming') # Returns: 'progamin'