implemented remove_duplicate_chars algorithm