My code is giving segmentation fault

Hi… I have corrected ur code… https://ide.codingblocks.com/s/602100
its working fine and passing all test cases…

Can you explain why it was giving segmentation fault

u were trying to mix string and character array…
for string just if u have to add character u can do it like str += ‘a’

so if I take output as character array then it would work fine, right?

thats ur choice… but u had initially declared string… so it needed to be done considering string only…

ohk thanks for the support

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.