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