String Compression Problem

My Code
It is passing two test case but somehow it is not passing other two test cases. A little insight might help.

Thank You

hello @anujkumardarji

u have to compress only consecutive same character.

for example->
aaaabba will be compressed as
a4b2a1

I have wrote condition on the line no 13, if(input[i] != input[i-1])

inner loop must start from i and end if u get any differnt character

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.