human
Sort an array of strings according to string lengths | Function to print the sorted array of string.
Function to Sort the array of string according to lengths . This function implements Insertion Sort ..
Insert s [ j ] at its correct position.
Driver code.
Function to perform sorting.
Calling the function to print result"
Solution in Python:
assistant
#Here is code to sort an array of strings according to string lengths and the other steps required.
 def printArraystring ( string , n ) :
	for i in range ( n ) :
		print ( string [ i ] , end = " ▁ " )
def sort ( s , n ) :
	for i in range ( 1 , n ) :
		temp = s [ i ]
		j = i - 1
		while j >= 0 and len ( temp ) < len ( s [ j ] ) :
			s [ j + 1 ] = s [ j ]
			j -= 1
		s [ j + 1 ] = temp
if __name__ == " _ _ main _ _ " :
	arr = [ " GeeksforGeeks " , " I " , " from " , " am " ]
	n = len ( arr )
	sort ( arr , n )
	printArraystring ( arr , n )