An optimal solution would be something like
- create an array of 26 or 52 bytes depending on whether this is case sensitive
- iterate over the string and set the byte corresponding to each letter’s position in the alphabet to 1
- iterate over the byte array and for each 1 you encounter print out the corresponding letter