human
Sort the given string using character search | Python 3 implementation to sort the given string without using any sorting technique.
A character array to store the no . of occurrences of each character between ' a ' to 'z.
to store the final sorted string.
To store each occurrence of character by relative indexing.
To traverse the character array and append it to new_str.
Driver program to test above"
How can the above be solved in Python?
 What is a code to sort the given string using character search and the other steps required?
assistant
#Here is code to sort the given string using character search and the other steps required.
 def sortString ( st , n ) :
'
	arr = [ 0 ] * 26
	new_str = " "
	for i in range ( n ) :
		arr [ ord ( st [ i ] ) - ord ( ' a ' ) ] += 1
	for i in range ( 26 ) :
		while ( arr [ i ] > 0 ) :
			new_str += chr ( i + ord ( ' a ' ) )
			arr [ i ] -= 1
	return new_str
if __name__ == " _ _ main _ _ " :
	st = " geeksforgeeks "
	n = len ( st )
	print ( sortString ( st , n ) )