#include<bits/stdc++.h>
#define ff first
#define ss second
#define int long long
#define pb push_back
using namespace std;
signed main(){
    int n, k, p=1, cnt1=0, cnt2=0;
    string s;
    cin>>n>>k>>s;
    int l=0, r=n-1; 
    while(l<=r){
        if(p==1){
            if(s[l]=='C' and s[r]=='C'){
                cnt1++;
            }
            else if(s[l]=='P'){
                l++;
            }
            else{
                r--;
            }
            if(cnt1>=k){
                cout<<"NE";
                return 0;
            }
            p=0;
        }
        else{
            if(s[l]=='C' and s[r]=='C'){
                cnt2++;
            }
            else if(s[l]=='P'){
                l++;
            }
            else{
                r--;
            }
            if(cnt2>=k){
                cout<<"DA";
                return 0;
            }
            p=1;
        }
    }
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |