第三题,大佬们帮看下,思路应该没错啊,为啥只通过6.多% import collections
if __name__ == "__main__":
n, m = list(map(int, input().strip().split()))
A = input()
B = input()
count = 0
for i in range(1, n+1):
for j in range(m+1-i):
scount = collections.Counter(B[j:j+i])
acount = collections.Counter(A)
t = 0
for k in scount:
if k in acount and scount[k]<=acount[k]:
t+=1
if t == i:
count = count + 1
print(count)