This problem taught you character-by-character string processing. You learned to iterate through a string and use if statements to handle different characters differently.
I showed you counting sort, where you count occurrences instead of using a general sorting algorithm. When the range of values is small, counting is simpler and faster than sorting.
You also learned about building delimited output.