Can you tell me why my code is failing the 2 test cases

hello @anshulgurawalia

the logic is bit incorrect.

what u r doing is if i and i+1 characters are same then u are puting i+2 at i+1 which sometimes fails

for example-> aaaa
as per ur logic u will print aa

hint -> include any charater in ur final string only when next charaterr is different otherwise skip it.

i am not able to make my code like that

check this->

please check this code is not passing the last test case

check now->

changed array size

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.