function in python that finds the first string can become the same as the second string by inserting or deleting a single character
<p>I need to write a function in python that accepts two strings as input arguments and returns:</p>

<ul>
<li>0 if the two strings match exactly.  </li>
<li>1 if the first string can become the same as the second string by inserting or deleting a single character (not replacing them)  </li>
<li>2 otherwise</li>
</ul>

<p>I  did manage to do for 0 and 2, but having problems with 1.
Any ideas?</p>

<pre><code>def single_insert_or_delete(s1,s2):
    s1lower=s1.lower()
    s2lower=s2.lower()
    str_1=list(s1lower)
    str_2=list(s2lower)
    string_1=set(str_1)
    string_2=set(str_2)
    mismatch=list(string_1.symmetric_difference(string_2))
    exact="0"
    one_change="1"
    otherwise="2"
    if s1lower==s2lower:
        return int(exact)
    elif len(mismatch)&lt;2:
        ????????
        return int(one_change)
    else:
        return int(otherwise)

s1=input("write a word: ")
s2=input("write a word: ")
print(single_insert_or_delete(s1,s2))
</code></pre>