#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793238463;
const int N = 1e6 + 20;
const long long INF = 1LL << 60;
template <class T>
void chmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
void chmin(T &a, T b) {
  if (a > b) a = b;
}
pair<long long, long long> dp[N];
long long n, k, l;
long long cnt(long long mid, vector<long long> a) {
  for (long long i = 0; i <= n; ++i) {
    dp[i] = make_pair(INF, INF);
  }
  dp[0] = make_pair(0, 0);
  for (long long i = 0; i < n; ++i) {
    if (dp[i + 1] > make_pair(dp[i].first + a[i], dp[i].second)) {
      dp[i + 1] = make_pair(dp[i].first + a[i], dp[i].second);
    }
    if (dp[min(n, i + l)] > make_pair(dp[i].first + mid, dp[i].second + 1)) {
      dp[min(n, i + l)] = make_pair(dp[i].first + mid, dp[i].second + 1);
    }
  }
  return dp[n].second;
}
long long findans(vector<long long> v) {
  long long l = 0, r = n;
  long long rem = 0;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (k < cnt(mid, v))
      l = mid + 1, rem = mid;
    else
      r = mid - 1;
  }
  long long x = cnt(rem, v);
  if (x <= k) return 0;
  x = cnt(rem + 1, v);
  return dp[n].first - (rem + 1LL) * k;
}
int main() {
  cin >> n >> k >> l;
  string second;
  cin >> second;
  vector<long long> lw(n, 0), up(n, 0);
  int l = 0, u = 0;
  for (long long i = 0; i < second.length(); ++i) {
    if (islower(second[i]))
      lw[i] = 1;
    else
      up[i] = 1;
  }
  long long mini = findans(lw);
  long long minu = findans(up);
  cout << min(mini, minu) << endl;
}
