String compression 2 test-case failed

please look at my approach and suggest me where i am wrong here my code…

thank you

Hello @Diwyanshu,

Your code is failing for test cases like:
aaabacb
Expected Output:
a3b1a1c1b1
Your Output:
a4b2c1

Hope, this would help.
Give a like if you are satisfie.

thank you sir :heart: