String Compression


I wrote this code for string compression but for 2 of my test cases it is showing wrong answer. What is the mistake?

You are printing the total frequency of a character whenever you see it in the code, which is incorrect.
For Example:
Input: aabcabc
Your Output: a3b2c2a3b2c2
Correct Output: a2b1c1a1b1c1

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.