#include <bits/stdc++.h>
using namespace std;
int n, l, k;
inline int ID(char x) {
  if (x >= 'A' && x <= 'Z') return 0;
  return 1;
}
const long long INF = 1000000000000000 + 7;
pair<long long, long long> judge(long long cost, vector<int>& a) {
  vector<pair<long long, long long> > dp(n + 1, {INF, k + 1});
  dp[0] = {0LL, 0LL};
  for (int i = (0); i < (n); ++i) {
    dp[i + 1] = min(dp[i + 1], {dp[i].first + a[i], dp[i].second});
    int xt = min(n, i + l);
    dp[xt] = min(dp[xt], {dp[i].first + cost, dp[i].second + 1});
  }
  return dp[n];
}
long long solve(vector<int>& a) {
  long long L, R;
  L = 0, R = n;
  while (L < R) {
    int mid = R - (R - L + 1) / 2;
    if (judge(mid, a).second <= k)
      R = mid;
    else
      L = mid + 1;
  }
  auto ans = judge(R, a);
  if (ans.second > k) exit(-1);
  return ans.first - 1LL * k * L;
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k >> l;
  string s;
  cin >> s;
  vector<vector<int> > a(2, vector<int>(n));
  for (int i = (0); i < (n); ++i) {
    if (s[i] >= 'A' && s[i] <= 'Z')
      a[0][i] = 1;
    else
      a[0][i] = 0;
  }
  for (int i = (0); i < (n); ++i) {
    if (s[i] >= 'a' && s[i] <= 'z')
      a[1][i] = 1;
    else
      a[1][i] = 0;
  }
  cout << min(solve(a[0]), solve(a[1])) << endl;
  return 0;
}
