human
Count of non | Iterative Function to calculate base ^ pow in O ( log y ).
Function to return the count of non palindromic strings.
Count of strings using n characters with repetitions allowed.
Count of palindromic strings.
Count of non - palindromic strings.
Driver code"
Solution in Python:
assistant
#Here is code to count of non and the other steps required.
 def power ( base , pwr ) :
	res = 1
	while ( pwr > 0 ) :
		if ( pwr & 1 ) :
			res = res * base
		base = base * base
		pwr >>= 1
	return res
def countNonPalindromicString ( n , m ) :
	total = power ( n , m )
	palindrome = power ( n , m // 2 + m % 2 )
	count = total - palindrome
	return count
if __name__ == ' _ _ main _ _ ' :
	n = 3
	m = 5
	print ( countNonPalindromicString ( n , m ) )