Help me in solving BLAST3 problem

My issue: for n=5 how does the solution of author works?like suppose he said we only look for index divisible by 3 so 0 and 3 are such two index foir n=5 but how can we remove three indexs such that it is a aplindrome i.e we can remove index 1 and 2 but that equal to 3 so plz explain for n=5

My code

#include <iostream>
using namespace std;
#define ll long long
int main() {
	 int t;
    cin >> t;
    while(t--){
        ll n,m,f1=0;
        string s;
        cin>>n>>s;
        if(n%3==1) f1=1;
        else{
            for (char ch = 'a'; ch <= 'z'; ch++)
            {
                int r = n + 1, l = -1;
                for (int i = 0; i < n; i++)
                {
                    if (i % 3 == 0 && s[i] == ch)
                    {
                        r = i;
                        break;
                    }
                }
                for (int i = n - 1; i >= 0; i--)
                {
                    int p = n - 1 - i;
                    if (p % 3 == 0 && s[i] == ch)
                    {
                        l = i;
                        break;
                    }
                }

                if (r < l)
                {
                    f1 =1;
                    break;
                }
            }
        }
        if(f1) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}// your code goes here

Problem Link: BLAST3 Problem - CodeChef

@aastha_ojha204
i haven’t seen the solution but what i think of is that for n%3==1 it would be always yes then because we can always make a 1 size palindrome.
and for rest
if i m able to make the starting and the ending of the string same then it would be always yes

can u plz explain for n=5 bcoz acc to question we have to remove index i ,i-1,i+1 so if index %3==0 we have only two choices 0 and 3 but in that case we cant remove three indexes which are consecutive

yes we can’t do it for 0 can u plz elaborate your doubt with an example .
Like for n=5 what i do is its %3 is not equals to 1 so the answer can be no so lets take an example abcda the last and the first character of the string is same and if i choose i==2 (0 based indexing) then i will get aa as the string which will be a palindrome.
if aabcd i will choose i==3 if bcdaa i will choose i==1 so it can vary from example to example.