Help me in solving BLAST3 problem

My issue

My code

#include <iostream>
using namespace std;

int main() {
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        string s;
        cin>>s;
        for(int j=0;j<26;j++){
        bool st=0;
        bool ed=0;
        int start=0;
        int end=n-1;
        char fix='a'+j;
        while(start<n){
            if(s[start]==fix && start%3==0){
                st=true;
            }
            start++;
        }
        while(end>=0){
            if(s[end]==fix && (n-end-1)%3==0){
                ed=true;
            }
            end--;
        }
        if(st==true && ed==true){
            cout<<"yes"<<endl;
            break;
        }
        if(j==25){
            cout<<"No"<<endl;
        }
        }
    }
}

Problem Link: BLAST3 Problem - CodeChef

@nandaaryan823
one more condition like end should be > start for for valid answer then only u can get yes
and also for n%3==1 the answer will always be yes u can always make 1 size palindrome