#include #include #include #include using namespace std; using namespace atcoder; using ll = long long; ll conv_ch(char c) { ll ret; if (c >= 'A' && c <= 'Z') { ret = ((ll)(c - 'A') + 1) * 10000 + 1; } else { ret = ((ll)(c - 'a') + 1) * 10000; } return ret; } int main() { ll N, M, K; cin >> N >> M >> K; string S; string T; cin >> S; cin >> T; vector sq_sum_s(N + 1, 0); ll sq_sum_t = 0; vector val_s(N, 0); vector val_t(M, 0); for (ll i = 0; i < N; i++) { ll val = conv_ch(S[i]); sq_sum_s[i + 1] = sq_sum_s[i] + val * val; val_s[i] = val; } for (ll i = 0; i < M; i++) { ll val = conv_ch(T[M - 1 - i]); sq_sum_t += val * val; val_t[i] = val; } vector conv_st = convolution_ll(val_s, val_t); ll ans = 0; for (ll i = M - 1; i <= N - 1; i++) { ll diffs = (sq_sum_s[i + 1] - sq_sum_s[i + 1 - M]) + sq_sum_t - 2 * conv_st[i]; if (diffs >= 1 && diffs <= K) { ans++; } } cout << ans << endl; }