I wrote this code it works for only 2/4 test cases I wanted to unlock the other test cases but doesn’t allow me could you please tell me the problem in the code.
//#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
if(s.length()>1)
for(int i=0;i<s.length();i++)
{ int count=1;
for(int j=i+1;j<s.length();j++)
{
if(s[i]==s[j])
{
count++;
}
}
cout<<s[i]<<count;
i=i+count-1;
}
if(s.length()==1)
cout<<s<<“1”;
}