#include <bits/stdc++.h>
using namespace std;
const int MX = 1000005, inf = 1e9;
int n, k, l, a[MX];
string s;
pair<int, int> mem[MX];
pair<int, int> operator+(pair<int, int> a, pair<int, int> b) {
  return {a.first + b.first, a.second + b.second};
}
pair<int, int> &dp(int m) {
  for (int i = 0; i < n + 1; i++) mem[i] = {inf, inf};
  mem[0] = {0, 0};
  for (int i = 0; i < n; i++) {
    mem[i + 1] = min(mem[i + 1], mem[i] + pair<int, int>(a[i], 0));
    mem[min(i + l, n)] = min(mem[min(i + l, n)], mem[i] + pair<int, int>(m, 1));
  }
  return mem[n];
}
int solve() {
  int i = 0, j = MX, rep = 22;
  while (rep--) {
    int m = (i + j) / 2;
    pair<int, int> &r = dp(m);
    if (r.second <= k)
      j = m;
    else
      i = m;
  }
  pair<int, int> &r = dp(j);
  return r.first - 1ll * j * k;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k >> l >> s;
  for (int i = 0; i < n; i++) a[i] = 'a' <= s[i] && s[i] <= 'z';
  int res = solve();
  for (int i = 0; i < n; i++) a[i] = 1 - a[i];
  res = min(res, solve());
  cout << res << '\n';
  return 0;
}
