Hi, Can you please tell me what is the issue with this code?

Check for input: abaaac
Try to debug for this. If fails to do it. Let me know will help accordingly.

I changed it a bit it is passing for the given case but still failing for some.

Yes you are close now, see for this test case
aaabbaaaacaa
For this when you get a[i] == a[i+1] just run a loop till the same character.

Just one case failing now.

Check now ->

The only change you made is out[j]=’\0’; ?

Yes only one change assigning null to avoid garbage values

Okay Cool. Thanks a lot. You can close the thread.

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.