func_code_string: #include <bits/stdc++.h>   using namespace std;   const int oo = 1e9 + 9;   const long long inf = 1e18 + 18;   const int max6 = 1e6 + 6;   const int modx = 1e9 + 123;   const int mody = 997;   const int base = 137;   int t[max6];   int n, k;   bool ok(int l, int r) {     int cnt = 0;     for (int i = l; i <= r; ++i) cnt += t[i] == 1;     if (cnt) return false;     int cur = 0;     for (int i = r + 1; i <= n; ++i) {       if (t[i] == 2)         cur++;       else         cur = 0;       if (cur > k) return false;     }     for (int i = 1; i < l; ++i) {       if (t[i] == 2)         cur++;       else         cur = 0;       if (cur > k) return false;     }     return true;   }   int main() {     cin >> n >> k;     string s;     cin >> s;     for (int i = 1; i <= n; ++i)       if (s[i - 1] ==  Y )         t[i] = 1;       else if (s[i - 1] ==  N )         t[i] = 2;       else if (s[i - 1] ==  ? )         t[i] = 3;     int res = 0;     for (int i = 1; i <= n; ++i)       if (i == 1 || t[i - 1] == 1 || t[i - 1] == 3) {         int j = i + k - 1;         if (j == n || t[j + 1] == 1 || t[j + 1] == 3)           if (ok(i, j)) res = 1;       }     cout << (res ?  YES  :  NO );   }   