#include <bits/stdc++.h>
using namespace std;
long long n, m, l;
string input;
long long currnum;
long long calc(long long k, vector<long long> &vect1) {
  vector<long long> dp(n + 1, INT_MAX);
  vector<long long> cnt(n + 1, 0);
  dp[0] = 0;
  for (long long i = 0; i < n; i++) {
    if (dp[i + 1] > dp[i] + vect1[i]) {
      dp[i + 1] = dp[i] + vect1[i];
      cnt[i + 1] = cnt[i];
    } else if (dp[i + 1] == dp[i] + vect1[i]) {
      cnt[i + 1] = min(cnt[i], cnt[i + 1]);
    }
    if (dp[min(n, i + l)] > dp[i] + k) {
      dp[min(n, i + l)] = dp[i] + k;
      cnt[min(n, i + l)] = cnt[i] + 1;
    } else if (dp[min(n, i + l)] == dp[i] + k) {
      cnt[min(n, i + l)] = min(cnt[i] + 1, cnt[min(n, i + l)]);
    }
  }
  currnum = dp[n];
  return cnt[n];
}
long long find(vector<long long> vect1) {
  long long lo = 0, hi = n + 1;
  while (lo + 1 != hi) {
    long long mid = (lo + hi) / 2;
    if (calc(mid, vect1) > m) {
      lo = mid;
    } else {
      hi = mid;
    }
  }
  lo++;
  calc(lo, vect1);
  return currnum - (lo * m);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> l;
  cin >> input;
  vector<long long> vect1(n + 1, 0);
  for (long long i = 0; i < n; i++) {
    if (input.at(i) >= 'a' && input.at(i) <= 'z') {
      vect1[i] = 1;
    }
  }
  long long ans = INT_MAX;
  ans = find(vect1);
  for (long long i = 0; i < n; i++) {
    vect1[i]++;
    vect1[i] %= 2;
  }
  ans = min(ans, find(vect1));
  cout << max((long long)0, ans);
}
