human
Longest Non | utility function to check whether a string is palindrome or not.
Check for palindrome ..
palindrome string.
function to find maximum length substring which is not palindrome.
to check whether all characters of the string are same or not.
All characters are same , we can 't  make a non-palindromic string..
If string is palindrome , we can make it non - palindrome by removing any corner character.
Complete string is not a palindrome ..
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to longest Non and the other steps required.
 def isPalindrome ( str ) :
	n = len ( str )
	for i in range ( n // 2 ) :
		if ( str [ i ] != str [ n - i - 1 ] ) :
			return False
	return True
def maxLengthNonPalinSubstring ( str ) :
	n = len ( str )
	ch = str [ 0 ]
	i = 1
	for i in range ( 1 , n ) :
		if ( str [ i ] != ch ) :
			break
	if ( i == n ) :
		return 0
	if ( isPalindrome ( str ) ) :
		return n - 1
	return n
if __name__ == " _ _ main _ _ " :
	str = " abba "
	print ( " Maximum ▁ length ▁ = " , maxLengthNonPalinSubstring ( str ) )