#include<iostream>#include<cstdio>#include<string>#include<cstring>#include<algorithm>#include<queue>#include<vector>usingnamespace std;typedefunsignedlonglong ULL;constint P =131;constint N =2e5+10;int n, m, q, x;char a[N], b[N];int pa[N], pb[N], ha[N], hb[N];int cnt[N];
ULL get(char c,int l,int r){if(c =='a'){return ha[r]- ha[l -1]* pa[r - l +1];}else{return hb[r]- hb[l -1]* pb[r - l +1];}}intmain(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cin >> n >> m >> q;
cin >> a +1>> b +1;//预处理hash
pa[0]=1;for(int i =1; i <= n; i++){
ha[i]= ha[i -1]* P + a[i];
pa[i]= pa[i -1]* P;}
pb[0]=1;for(int i =1; i <= m; i++){
hb[i]= hb[i -1]* P + b[i];
pb[i]= pb[i -1]* P;}//二分求匹配的最大长度for(int i =1; i <= n; i++){int l =0, r =min(n - i +1, m);while(l < r){int mid =(l + r)>>1;if(get('a', i, i + mid)==get('b',1,1+ mid)) l = mid+1;else r=mid;}
cnt[l]++;}while(q--){
cin >> x;
cout << cnt[x]<< endl;}return0;}