Doubt in compression of string

code–https://ide.codingblocks.com/s/388499
ques–https://hack.codingblocks.com/app/contests/1975/380/problem

Hello @aaliyah_beg your logic is wrong you have not understood the question clearly.
suppose if the input is aaabcda
then the output should be
a3b1c1d1a1
you dont have to print the occurence off all the letters alphabetically or in one go .
string compression means that if there same elements continuoud somewhere then you have to print how many elements same which are encountered in one go.
Here for your reference i am attaching the code:


Happy Learning!!

okay sir , got it! The example given made me think its only alphabetically

@aaliyah_beg if you feel that your doubt is resolved you can mark this doubt as resolved now.

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.