SyntaxFix
Write A Post
Hire A Developer
Questions
For completeness sake, here's another recipe that sorts the letters as a byproduct of the way it works:
>>> from itertools import groupby >>> ''.join(k for k, g in groupby(sorted("aaabcabccd"))) 'abcd'