HERE IS MY CODE

#include<bits/stdc++.h>

#include

#include

using namespace std;

int main()

{

int t;

cin>>t;

while(t–){

string s;

cin>>s;

int n=s.length();

vectorv;

v.push_back(0);

int ans=0;

for(int i=1;i<n;i++)

{

if(s[i]!=s[i-1])v.push_back(i);

}

v.push_back(n-1);

for(int i=0;i<v.size();i++)cout<<v[i]<<" ";cout<<endl;

for(int i=1;i<v.size();i++)

{

int k=v[i]-v[i-1];

if(k<10)ans=ans+2;

else if(k>=10 && k<=99)ans=ans+3;

else if(k>=100 && k<=999)ans=ans+4;

else if(k==1000)ans=ans+5;

}

// cout<<n<<endl;

//cout<<ans<<endl;

if(ans<n)cout<<“YES”<<endl;

else cout<<“NO”<<endl;

}

}