Testcases are not passing

I think my code is correct but since then my test cases are not passing please help me with this

hi jatin
share ur code so that we can debug it

only half of the test cases are passing

by this u have sort the string by character
like if s=aacccbb
ur output
a2b2c3
but correct ans
a2c3b2

can you please help me with the changes I need to adapt in this for solution

simplly iterate the string and maintain a count variable =1;
when a[i]==a[i+1]
count++;
else
cout<<a[i]<<count;
count=1

1 Like

thanx it worked
thank you for such good level of clearification