Why my code is giving runtime error?

I was trying to solve ā€œare they sameā€ problem. Iā€™m getting runtime error.

Plz help me find out error in my code, as the sample test cases are running fine.

Hereā€™s the link to my code: https://ide.codingblocks.com/s/304971

@siddharth_1_3277 i think the run time error is because of this part. Size of the string is 0 initially, then how can you assign anything to a1[i] like that ? You need to append the characters like this:
a1 += s1[i];
image

corrected code:

Hi @siddharth_1_3277 please mark your doubt as resolved in case of no further queries

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.