#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
int n, k, l;
vector<long long> S;
pair<long long, long long> calc(long long lambda) {
  vector<long long> DP, T;
  DP = vector<long long>(n);
  T = vector<long long>(n);
  for (int i = 0; i < n; i++) {
    long long v1, v2, t1, t2;
    if (i < l) {
      v1 = 0;
      t1 = 0;
      v2 = S[i] - lambda;
      t2 = 1;
    } else {
      v1 = DP[i - 1];
      t1 = T[i - 1];
      v2 = DP[i - l] + S[i] - S[i - l] - lambda;
      t2 = T[i - l] + 1;
    }
    if (v1 > v2) {
      DP[i] = v1;
      T[i] = t1;
    } else if (v2 > v1) {
      DP[i] = v2;
      T[i] = t2;
    } else {
      DP[i] = v1;
      T[i] = min(t1, t2);
    }
  }
  return {DP[n - 1], T[n - 1]};
}
long long getMin(vector<bool> A) {
  S = vector<long long>(n);
  S[0] = A[0];
  for (int i = 1; i < n; i++) {
    S[i] = S[i - 1] + A[i];
  }
  long long lo = 0;
  long long hi = (long long)2e6;
  long long v, t;
  while (lo < hi) {
    long long m = (lo + hi) / 2;
    tie(v, t) = calc(m);
    if (t > k)
      lo = m + 1;
    else
      hi = m;
  }
  tie(v, t) = calc(lo);
  return S[n - 1] - (v + k * lo);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  vector<bool> A, B;
  cin >> n >> k >> l;
  cin >> s;
  A = vector<bool>(n);
  B = vector<bool>(n);
  for (int i = 0; i < n; i++) {
    if (s[i] >= 'a')
      A[i] = true;
    else
      B[i] = true;
  }
  cout << min(getMin(A), getMin(B)) << endl;
  return 0;
}
