Given two strings of lower alphabet characters, we need to find the number of ways to insert a character in the first string such that length of LCS of both strings increases by one.
The first line of the contains T denoting the number of testcases. Then T testcases follow. The first line of each test case contains integers N and M denoting the length of strings str1 and str2.
The second line of each test case contains the strings str1 and str2 consisiting of only lower case alphabets.
Print the answer for each test case in a new line.
1<= T <=100
1<= N, M <=100
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.