fork download
  1. #include <bits/stdc++.h>
  2. #define F(i, a, n) for (int i = 0; i < n; i ++)
  3. using namespace std;
  4. int main() {
  5. int n, k; string s; cin >> n >> k >> s;
  6. int t = 0;
  7. F(i, 0, k) {
  8. int p = i;
  9. int curr = 0;
  10. while (p < n) {
  11. if (s[p] == 'o') curr ++;
  12. else {
  13. if (curr) {
  14. curr = 0;
  15. t ++;
  16. }
  17. }
  18. p += k;
  19. }
  20. if (curr) t ++;
  21. }
  22. cout << t;
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 592KB
stdin
Standard input is empty
stdout
Standard output is empty