#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P) {
  in >> P.first >> P.second;
  return in;
}
template <class T1, class T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P) {
  out << "(" << P.first << ", " << P.second << ")";
  return out;
}
template <class T>
istream &operator>>(istream &in, vector<T> &arr) {
  for (auto &x : arr) in >> x;
  return in;
}
template <class T>
ostream &operator<<(ostream &out, const vector<T> &arr) {
  for (auto &x : arr) out << x << ' ';
  cout << "\n";
  return out;
}
template <class T>
istream &operator>>(istream &in, deque<T> &arr) {
  for (auto &x : arr) in >> x;
  return in;
}
template <class T>
ostream &operator<<(ostream &out, const deque<T> &arr) {
  for (auto &x : arr) out << x << ' ';
  cout << "\n";
  return out;
}
long long n, m, q, k, v[1000050], l, pref[1000050];
pair<long long, long long> TT, w[1000050];
string second;
long long dp[1000050];
long long prox[1000050];
long long resolve(long long cost) {
  memset(dp, 0, sizeof dp);
  for (long long i = n; i >= 1; i--) {
    long long A =
        dp[min(n + 1, i + l)] + (pref[min(n, i + l - 1)] - pref[i - 1]) - cost;
    long long B = dp[i + 1];
    if (A > B)
      prox[i] = 0;
    else
      prox[i] = 1;
    dp[i] = max(A, B);
  }
  long long j = 1, usados = 0;
  while (j <= n) {
    if (!prox[j])
      usados++, j = j + l;
    else
      j = j + 1;
  }
  return usados;
}
long long solve(long long a, long long b) {
  long long ini = 0, fim = 200000000000000000, mid, best = -1;
  while (fim >= ini) {
    mid = (ini + fim) / 2;
    long long us = resolve(mid);
    if (us <= k)
      best = mid, fim = mid - 1;
    else
      ini = mid + 1;
  }
  if (best == -1) return 0;
  long long us = resolve(best);
  return dp[1] + k * best;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k >> l;
  cin >> second;
  for (long long i = 1; i <= n; i++) {
    if ('a' <= second[i - 1] and second[i - 1] <= 'z')
      v[i] = 0;
    else
      v[i] = 1;
  }
  for (long long i = 1; i <= n; i++) pref[i] = pref[i - 1] + v[i];
  long long A = pref[n] - solve(1, k);
  for (long long i = 1; i <= n; i++) {
    v[i] ^= 1;
    pref[i] = pref[i - 1] + v[i];
  }
  long long B = pref[n] - solve(1, k);
  cout << min(A, B) << "\n";
}
