for _ in range(int(input())):
n = int(input())
arr = list(input())
brr = list(input())
bo = [True] * n
count = 0
if arr[0] == brr[0]:
count += 1
elif brr[0] != 'N':
bo[0] = False
# print(count)
for i in range(1, n - 1):
if bo[i - 1]:
if arr[i] == brr[i]:
count += 1
elif brr[i] != 'N':
bo[i] = False
if arr[-1] == brr[-1]:
count += 1
print(count)
I’m not getting why the above solution is failing, please help me out. If possible give me a test case which may output wrong answer.