119. One Edit Away
MediumTwo Pointers
Print YES if the two strings are exactly one edit apart (one insert, delete or replace), else NO. Identical strings are zero edits apart.
Input format
Line 1: a Line 2: b
Output format
YES or NO
Example 1
Input
pale ple
Output
YES
Example 2
Input
pales pale
Output
YES
Constraints
1 ≤ |a|, |b| ≤ 10⁵
Read input from standard input and print the answer to standard output. Your code is judged against 6 test cases, most of them hidden.
Loading the MyLoginn IDE…