#K32847. One Edit Distance Checker
One Edit Distance Checker
One Edit Distance Checker
You are given two strings, s and t. Your task is to determine whether you can transform string s into string t using exactly one edit operation. An edit operation is defined as one of the following:
- Inserting a single character
- Removing a single character
- Replacing a single character
In other words, the two strings are exactly one edit apart if \[ |\text{len}(s) - \text{len}(t)| \leq 1 \] and there is exactly one position at which they differ (taking into account the shift that occurs when a character is inserted or deleted).
Note: If the two strings are identical, then the answer is False
.
inputFormat
The input consists of two lines read from standard input. The first line contains the string s and the second line contains the string t.
outputFormat
Print a single line to standard output: True
if the two strings are exactly one edit distance apart, or False
otherwise.
kitten
sitten
True