human
Sort a string according to the frequency of characters | Returns count of character in the string.
Check for vowel.
Function to sort the string according to the frequency.
Vector to store the frequency of characters with respective character.
Inserting frequency with respective character in the vector pair.
Sort the vector , this will sort the pair according to the number of characters.
Print the sorted vector content.
Driver code"
Solution in Python:
 ... What is a code to sort a string according to the frequency of characters and the other steps required?
assistant
#Here is code to sort a string according to the frequency of characters and the other steps required.
 def countFrequency ( string , ch ) :
	count = 0 ;
	for i in range ( len ( string ) ) :
		if ( string [ i ] == ch ) :
			count += 1 ;
	return count ;
def sortArr ( string ) :
	n = len ( string ) ;
	vp = [ ] ;
	for i in range ( n ) :
		vp . append ( ( countFrequency ( string , string [ i ] ) , string [ i ] ) ) ;
	vp . sort ( ) ;
	for i in range ( len ( vp ) ) :
		print ( vp [ i ] [ 1 ] , end = " " ) ;
if __name__ == " _ _ main _ _ " :
	string = " geeksforgeeks " ;
	sortArr ( string ) ;