Help me in solving HATTRICK problem

My issue

include <bits/stdc++.h>
using namespace std;

int main() {
// your code goes here
int t;
cin>>t;
while(t–){
int flag=0;
vector v(6);
for(int i=0;i<6;i++)
cin>>v[i];
for(int i=0;i<4;i++){
if(v[i]==v[i+1]&&v[i]==v[i+2]){
flag=1;
break;
}
}
if(flag==1)
cout<<“YES”<<endl;
else cout<<“NO”<<endl;
}
}
what is the problem in this code

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int   t;
	cin>>t;
	while(t--){
	    int flag=0;
	    vector<char> v(6);
	    for(int i=0;i<6;i++)
	     cin>>v[i];
	     for(int i=0;i<4;i++){
	         if(v[i]==v[i+1]&&v[i]==v[i+2]){
	             flag=1;
	             break;
	         }
	     }
	     if(flag==1)
	     cout<<"YES"<<endl;
	     else cout<<"NO"<<endl;
	}
}

Problem Link: Hattrick Practice Coding Problem - CodeChef

@ayirp3030
plzz refer my c++ solution for better understanding of the logic

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    char a[6];
	    int fnd=0;
	    for(int i=0;i<6;i++)
	    {
	        cin>>a[i];
	    }
	    for(int i=1;i<5;i++)
	    {
	        if(a[i]=='W'&&a[i-1]=='W'&&a[i+1]=='W')
	        {
	            fnd=1;
	        }
	    }
	    if(fnd)
	    cout<<"YES";
	    else
	    cout<<"NO";
	    cout<<endl;
	}

}

Hello friend,
You have to set them equal to the character ‘W’.
While you are checking v[i]==v[i+1] && v[i]==v[i+2] you also have to know that not only they are equal but also equal to ‘W’. So that three consecutive wickets makes a Hatrick.
so, the refined condition should be
v[i]==v[i+1] && v[i]==v[i+2] && v[i]==‘W’

Wish it was helpful.

Have a great day.