Write a program to determine whether two words are similar.
Two words are considered similar if either of the following conditions is true:
The two words have the same length, and by swapping two consecutive characters in one of the words, we can obtain the other word.
For example, best and bets are similar because if we swap the characters s and t in “best,” we get “bets.”
The two words differ in length by one, and by deleting one character from the longer word, we can obtain the shorter one.
For example, best and bet are similar because if we delete the s from “best,” we get “bet.”
Each line of input contains two words to be compared.
The program must process all input until EOF.
The maximum word length is n, where 0 < n ≤ 80.
If a pair of words is similar, output yes; otherwise, output no.
Two words.
The program must process all input until EOF.
(The maximum word length is n, where 0 < n ≤ 80.)
If a pair of words is similar, output yes; otherwise, output no.