Skip to main content
1 of 3
t-clausen.dk
  • 3.8k
  • 12
  • 16

T-SQL, 172 bytes

SELECT STRING_AGG(c,'')WITHIN GROUP(ORDER BY
x)FROM(SELECT substring(@,number,1)x,sum(1)c
FROM spt_values WHERE type='P'GROUP BY substring(@,number,1))x
WHERE x like'[a-z]'

Try it online

This will work as long as the input less than 2048 characters. It does order the output according to the position of the letter in the alphabet

t-clausen.dk
  • 3.8k
  • 12
  • 16