human
Smallest integer greater than n such that it consists of digit m exactly k times | Function that returns true if n contains digit m exactly k times.
Function to return the smallest integer > n with digit m occurring exactly k times.
Driver code"
How can the above be solved in Python?
 Can you provide a code to smallest integer greater than n such that it consists of digit m exactly k times and the other steps required?
assistant
#Here is code to smallest integer greater than n such that it consists of digit m exactly k times and the other steps required.
 def digitWell ( n , m , k ) :
	cnt = 0
	while ( n > 0 ) :
		if ( n % 10 == m ) :
			cnt = cnt + 1 ;
		n = ( int ) ( n / 10 ) ;
	return cnt == k ;
def findInt ( n , m , k ) :
	i = n + 1 ;
	while ( True ) :
		if ( digitWell ( i , m , k ) ) :
			return i ;
		i = i + 1 ;
n = 111 ; m = 2 ; k = 2 ;
print ( findInt ( n , m , k ) ) ;