human
Find the count of M character words which have at least one character repeated | Function to return the factorial of a number.
Function to return the value of nPr.
Function to return the total number of M length words which have at least a single character repeated more than once.
Driver code"
Solution in Python:

Give me a code to find the count of M character words which have at least one character repeated and the other steps required?
assistant
#Here is code to find the count of M character words which have at least one character repeated and the other steps required.
 def fact ( n ) :
	if ( n <= 1 ) :
		return 1 ;
	return n * fact ( n - 1 ) ;
def nPr ( n , r ) :
	return fact ( n ) // fact ( n - r ) ;
def countWords ( N , M ) :
	return pow ( N , M ) - nPr ( N , M ) ;
N = 10 ; M = 5 ;
print ( countWords ( N , M ) ) ;