#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int n, m, q, dp[N][N], p[N + N], used[N + N];
string s, t;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> q >> s >> t;
  string x = t + "#" + s;
  for (int i = 1; i < (int)x.size(); i++) {
    int j = p[i - 1];
    while (j > 0 && x[i] != x[j]) {
      j = p[j - 1];
    }
    if (x[i] == x[j]) {
      j++;
    }
    p[i] = j;
    if (p[i] == m) {
      used[i - m] = true;
    }
  }
  s = '#' + s;
  t = '%' + t;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      dp[i][j] = dp[i][j - 1] + (j - m + 1 >= i && used[j]);
    }
  }
  while (q--) {
    int l, r;
    cin >> l >> r;
    cout << dp[l][r] << "\n";
  }
}
