The output of this code continues to be 4. However, the output should be 3. The set intersection is present because I believe that is the key towards the answer. The reasoning for the answer being 4 instead of 3 comes from the number of 2 qs and 1 r that match s2 in s1.
s2 = "qsrqq"
s1 = "qqtrr"
counts1=0
counts2=0
letters= set.intersection(set(s1), set(s2))
for letter1 in set(s1):
counts1 += s2.count(letter1)
for letter2 in set(s2):
counts2 += s1.count(letter2)
counts = min(counts1, counts2)
print (counts)
Any help is much appreciated.