```
def isOneEditDistance(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
m = len(s)
n = len(t)
diff = abs(m - n)
if diff > 1:
return False
if m < n:
return self.isOneEditDistance(t, s)
i = 0
while i < n and s[i] == t[i]:
i = i + 1
if diff == 0:
i = i + 1
while i < n and s[i + diff] == t[i]:
i = i + 1
return i == n
```