#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, K, M;
  auto f = [&](string s) {
    int l = 0, r = N - 1, x = 0;
    while (l < r) {
      int m = l + r >> 1;
      vector<pair<int, int>> D(N);
      for (int i = 0; i < N; i++) {
        D[i] = i ? D[i - 1] : make_pair(0, 0);
        D[i].first += 'a' <= s[i] && s[i] <= 'z';
        D[i] = min(D[i],
                   i >= M ? make_pair(D[i - M].first + m, D[i - M].second + 1)
                          : make_pair(m, 1));
      }
      if (D[N - 1].second <= K)
        r = m, x = max(D[N - 1].first - K * m, 0);
      else
        l = m + 1;
    }
    return x;
  };
  string a;
  cin >> N >> K >> M >> a;
  string b = a;
  for (auto& c : b) c ^= 32;
  cout << min(f(a), f(b)) << '\n';
}
