Duplicate and format usimg recurrsion


my code is giving error (time limit exceed)
where am i wrong

I would suggest against manipulating the existing string as it is prone to bugs simply iterate the string and print on the go.

sorry but i didnt get you?? are you asking me to have one more character array and print that array ?? if yes? then also its giving me the same error

No, i am suggesting you to simply iterate the array and if s[i] == s[i-1] first print * then s[i]

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.