代码如下:
#include <iostream>
#include <cstring>
using namespace std;int main() {int cnt;cin >> cnt;string a, b;while (cnt--) {int n, m;cin >> n >> m;cin >> a;cin >> b;int ans = 0 ;for (int i = 0; i < n; i++)a[i] = tolower(a[i]);for (int i = 0; i < m; i++)b[i] = tolower(b[i]);for (int i = 0; i < m; i++) {if (b.substr(i, n) == a)ans++;}cout << ans << endl;}
}