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.
Input Format
A,B - Two strings of lowercase letters
Constraints
0<=len(A)<=100
0<=len(B)<=100
Output Format
Print 1 if packets are acceptable otherwise print 0
Sample Input 0
ab
ba
Sample Output 0
1
Explanation 0
You can swap A[0] = 'a' and A[1] = 'b' to get "ba", which is equal to B.
Sample Input 1
ab
ab
Sample Output 1
0
Explanation 1
The only letters you can swap are A[0] = 'a' and A[1] = 'b', which results in "ba" != B.
Get Free Quote!
324 Experts Online