#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const int N=2e6+10;
int k=2333;
ull mod=1e9+9;
string a,b;
int n,m,q,x;
ull hash_a[N];
ull hash_b[N];
ull pw[N];
map<int,int> ans;
ull gethash(ull hs[],int l,int r){
return hs[r]-hs[l-1]*pw[r-l+1];
}
bool check(int len,int s){
if(gethash(hash_a,s,s+len-1)==gethash(hash_b,1,len)) return true;
else false;
}
int main(){
cin>>n>>m>>q;
string s;
cin>>a>>b;
a="%"+a;
b="%"+b;
pw[0]=1;
for(int i=1;i<=n;i++){
hash_a[i]=(hash_a[i-1]*k+(ull)a[i]);
}
for(int i=1;i<=m;i++){
hash_b[i]=(hash_b[i-1]*k+(ull)b[i]);
}
for(int i=1;i<=max(n,m);i++) pw[i]=pw[i-1]*k;
for(int i=1;i<=n;i++){
int num=-1;
int l=0,r=m,mid;
while(l<=r){
mid=l+(r-l)/2;
if(check(mid,i)){
l=mid+1;
num=mid;
}else{
r=mid-1;
}
}
ans[num]++;
}
while(q--){
cin>>x;
cout<<ans[x]<<endl;
}
return 0;
}