#include <bits/stdc++.h>
using namespace std;
int N, K, L, V[1000001], P[1000001];
pair<long long, int> D[1000001];
pair<long long, int> solve2(int l) {
  int s = 0, e = 1;
  for (int i = 1; i < L; i++) {
    D[i] = {D[i - 1].first + V[i], 0};
    while (s < e && D[P[e - 1]].first >= D[i].first) e--;
    P[e++] = i;
  }
  for (int i = L; i <= N; i++) {
    while (s < e && P[s] + L < i) s++;
    D[i] = D[i - 1];
    D[i].first += V[i];
    if (s < e && D[i].first > D[P[s]].first + l) {
      D[i].first = D[P[s]].first + l;
      D[i].second = D[P[s]].second + 1;
    }
    while (s < e && D[P[e - 1]].first >= D[i].first) e--;
    P[e++] = i;
  }
  return D[N];
}
int solve() {
  int s = 0, e = L;
  while (s <= e) {
    int m = (s + e) >> 1;
    if (solve2(m).second <= K)
      e = m - 1;
    else
      s = m + 1;
  }
  auto ret = solve2(s);
  return max(ret.first - 1LL * K * s, 0LL);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ((void)0);
  ((void)0);
  ((void)0);
  int ans;
  string s;
  cin >> N >> K >> L;
  if (N <= 1LL * K * L) {
    cout << "0\n";
    return 0;
  }
  cin >> s;
  for (int i = 0; i < N; i++) V[i + 1] = s[i] < 'a';
  ans = solve();
  for (int i = 1; i <= N; i++) V[i] ^= 1;
  cout << min(ans, solve()) << '\n';
  return 0;
}
