fork download
  1. #include <bits/stdc++.h>
  2. #define fi first
  3. #define se second
  4. #define pb push_back
  5. #define ll long long
  6. #define endl "\n"
  7. #define __WaffledCookies__ signed main
  8. using namespace std;
  9.  
  10. const int N = 3e5 + 5, mod = 1e9 + 7, base = 167;
  11. int tc, n, k, ans = 0;
  12. string s;
  13. void solve()
  14. {
  15. cin >> n >> k >> s;
  16. s = ' ' + s;
  17. for(int i = 1; i <= n; ++i) if(s[i] == 'o' && (k >= i || s[i - k] == '.')) ans++;
  18. cout << ans;
  19. return;
  20. }
  21. __WaffledCookies__()
  22. {
  23.  
  24. ios_base::sync_with_stdio(0);
  25. cin.tie(0); cout.tie(0);
  26. tc = 1;
  27. //cin >> tc;
  28. while(tc--) solve();
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0s 544KB
stdin
Standard input is empty
stdout
Standard output is empty