Alice sends a data packet two times to Bob. Let A and B are the strings of lowercase letters that represent the packets received by Bob. Bob compares the packets and accepts them only if he can swap two letters in A so that the result is equal to B. Now you are asked to help Bob in determing whether the packets can be accepted or not. Print 1 if the packets are acceptable or else print 0.
A,B - Two strings of lowercase letters
Print 1 if packets are acceptable otherwise print 0
Sample Input 0
Sample Output 0
You can swap A = 'a' and A = 'b' to get "ba", which is equal to B.
Sample Input 1
Sample Output 1
The only letters you can swap are A = 'a' and A = 'b', which results in "ba" != B.
Get Free Quote!
347 Experts Online