Given two strings, the task is to check whether these strings are meta strings or not. Meta strings are the strings which can be made equal by exactly one swap in any of the strings. Equal string are not considered here as Meta strings.
Input : A = "geeks" B = "keegs" Output : 1 By just swapping 'k' and 'g' in any of string, both will become same. Input : A = "rsting" B = "string Output : 0
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains two lines. The first line denoting string A and the second line denoting string B.
For each test case in a new line print 1 if A and B are meta strings, else print 0.
1<=Length of strings<=1000
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.