human
Check if edit distance between two strings is one | Returns true if edit distance between s1 and s2 is one , else false.
Find lengths of given strings.
If difference between lengths is more than 1 , then strings can 't be at one distance.
count = 0 Count of isEditDistanceOne.
If current characters dont match.
If length of one string is more , then only possible edit is to remove a character.
else : If lengths of both strings is same.
Increment count of edits.
else : if current characters match.
if last character is extra in any string.
Driver program"
How can the above be solved in Python?
 ... Give me a code to check if edit distance between two strings is one and the other steps required?
assistant
#Here is code to check if edit distance between two strings is one and the other steps required.
 def isEditDistanceOne ( s1 , s2 ) :
	m = len ( s1 )
	n = len ( s2 )
	if abs ( m - n ) > 1 :
		return false
	i = 0
	j = 0
	while i < m and j < n :
		if s1 [ i ] != s2 [ j ] :
			if count == 1 :
				return false
			if m > n :
				i += 1
			elif m < n :
				j += 1
				i += 1
				j += 1
			count += 1
			i += 1
			j += 1
	if i < m or j < n :
		count += 1
	return count == 1
s1 = " gfg "
s2 = " gf "
if isEditDistanceOne ( s1 , s2 ) :
	print " Yes "
else :
	print " No "