STONES Wrong Answer

for _ in range (int(input())):
j=input()
s=input()
a=list(set(j)&set(s))
l=len(a)
print(l)
above code gives correct output but after submitting it shows wrong answer why?

Problem is due to usage of set. Set only contain unique elements
So input aabbaa will become {a,b} which can work for first input but not for second input.

Use list for second input.

Check out my submission : LINK