WA in CHEALG

#include <bits/stdc++.h>

using namespace std;
int check(string str,int len1)
{
int count;
string s="";
for(int i=0;i<len1;i=i+count)
{
count = 0;
for(int j=i;j<len1;j++)
{
if(str[i]==str[j])
{
count++;
}
}
s += str[i]+to_string(count);
}
int len2 = s.length();
//cout<<endl<<len2<<endl;
//cout<<endl<<s<<endl;
return len2;
}

int main() {
int t;
cin>>t;
while(t–)
{
string str;
cin>>str;
int len1 = str.length();
int len2 = check(str,len1);
if(len1<=len2)
cout<<“NO”<<endl;

    else
        cout<<"YES"<<endl;
}
return 0;

}

While compiling everything is fine. It’s from the dec lunchtime 2019. Check algorithm(CHEALG).

link : https://www.codechef.com/viewsolution/28532418

Random testcase for which your solution fails:

1
dlqcasapkfsimpdhnjeqhkkfoiccdilgafiacfmmhibafehsk

Edit:

Simpler testcase:

1
ccabbcabab

thanks, but changes should i make?