for test in range(int(input())):

c=0

a=input()

b=input()

for i in range(0,len(a)):

if(a.count(a[i])==2 and a!=b):

c=1

print(“A”)

break

if(len(a)==1 and b!=a and c==0):

c=1

print(“B”)

if(a==b and c==0):

c=1

print(“B”)

a1=a[:len(a)//2]

a2=a[len(a)//2+1:]

b1=b[:len(b)//2]

b2=b[len(b)//2+1:]

if(a1==a2 and b1!=b2 and c==0):

c=1

print(“A”)

if(b1==b2 and a1!=a2 and c==0):

c=1

print(“B”)

if(a1==a2 and b1==b2 and c==0):

c=1

print(“A”)

if(c==0):

print(“B”)

It would be helpful if critical test cases are given which fails through this code.

1

cdd

edd

Answer should be B here… Hope this will help to debug…

You may look into my code here for help…