#include <bits/stdc++.h>
using namespace std;
const int N = 1021;
int n, m, q, ans[N];
string s, t;
int main() {
  cin >> n >> m >> q;
  cin >> s >> t;
  for (int i = 0; i + m <= n; i++)
    if (s.substr(i, m) == t) ans[i + 1]++;
  for (int i = 2; i <= n; i++) ans[i] += ans[i - 1];
  while (q--) {
    int a, b;
    cin >> a >> b;
    b = b - m + 1;
    printf("%d\n", max(0, ans[max(0, b)] - ans[a - 1]));
  }
}
