C program to sort a string in alphabetic order: For example if user will enter a string “programming” then output will be “aggimmnoprr” or output string will contain characters in alphabetical order. In our program we assume input string contains only lower case alphabets. First we count and store how many times characters ‘a’ to ‘z’ appear in input string and then create another string which contains characters ‘a’ to ‘z’ as many times as they appear in the input string.
C programming code
Output of program: