human
Make palindromic string non | Function to print the non - palindromic string if it exists , otherwise prints - 1.
If all characters are not same , set flag to 1.
Update frequency of the current character.
If all characters are same.
Print characters in sorted manner.
Driver Code"
Solution in Python:
 ... Can you provide a code to make palindromic string non and the other steps required?
assistant
#Here is code to make palindromic string non and the other steps required.
 def findNonPalinString ( s ) :
	freq = [ 0 ] * ( 26 )
	flag = 0
	for i in range ( 0 , len ( s ) ) :
		if s [ i ] != s [ 0 ] :
			flag = 1
		freq [ ord ( s [ i ] ) - ord ( ' a ' ) ] += 1
	if not flag :
		print ( " - 1" )
	else :
		for i in range ( 0 , 26 ) :
			for j in range ( 0 , freq [ i ] ) :
				print ( chr ( ord ( ' a ' ) + i ) , end = " " )
if __name__ == " _ _ main _ _ " :
	s = " abba "
	findNonPalinString ( s )