human
Give me a code to converting one string to other using append and delete last operations and the other steps required given the following:
Converting one string to other using append and delete last operations | Returns true if it is possible to convert str1 to str2 using k operations ..
Case A ( i ).
finding common length of both string.
Case A ( ii ) -.
Case B -.
Driver Code"
Solution in Python:
assistant
#Here is code to converting one string to other using append and delete last operations and the other steps required.
 def isConvertible ( str1 , str2 , k ) :
	if ( ( len ( str1 ) + len ( str2 ) ) < k ) :
		return True
	commonLength = 0
	for i in range ( 0 , min ( len ( str1 ) , len ( str2 ) ) , 1 ) :
		if ( str1 [ i ] == str2 [ i ] ) :
			commonLength += 1
		else :
			break
	if ( ( k - len ( str1 ) - len ( str2 ) + 2 * commonLength ) % 2 == 0 ) :
		return True
	return False
if __name__ == ' _ _ main _ _ ' :
	str1 = " geek "
	str2 = " geek "
	k = 7
	if ( isConvertible ( str1 , str2 , k ) ) :
		print ( " Yes " )
	else :
		print ( " No " )
	str1 = " geeks "
	str2 = " geek "
	k = 5
	if ( isConvertible ( str1 , str2 , k ) ) :
		print ( " Yes " )
	else :
		print ( " No " )