human
Count of characters in str1 such that after deleting anyone of them str1 becomes str2 | Function to return the count of required indices.
Solution doesn 't exist.
Find the length of the longest common prefix of strings.
Find the length of the longest common suffix of strings.
If solution does not exist.
Return the count of indices.
Driver code"
How can the above be solved in Python?

What is a code to count of characters in str1 such that after deleting anyone of them str1 becomes str2 and the other steps required?
assistant
#Here is code to count of characters in str1 such that after deleting anyone of them str1 becomes str2 and the other steps required.
 def Find_Index ( str1 , str2 ) :
	n = len ( str1 )
	m = len ( str2 )
	l = 0
	r = 0
	if ( n != m + 1 ) :
		return - 1
	for i in range ( m ) :
		if str1 [ i ] == str2 [ i ] :
			l += 1
		else :
			break
	i = n - 1
	j = m - 1
	while i >= 0 and j >= 0 and str1 [ i ] == str2 [ j ] :
		r += 1
		i -= 1
		j -= 1
	if l + r < m :
		return - 1
	else :
		i = max ( n - r , 1 )
		j = min ( l + 1 , n )
		return ( j - i + 1 )
if __name__ == " _ _ main _ _ " :
	str1 = " aaa "
	str2 = " aa "
	print ( Find_Index ( str1 , str2 ) )