What is wrong in this code? (POPGATES)

Here is my submission for February Lunchtime 2020 Division 2 » At the Gates/problems/POPGATES/
https://www.codechef.com/viewsolution/29976670

I don’t get what is wrong in the code?

This solution is accepted, maybe you post a wrong link?

yaa, i corrected it. Now you can check

In the 19th line of your solution you have used arr[i] where the value of i will be ‘n’ which will result in an out of bound access of a value. So before that just decrement the value of i.
Also after taking the two integers as an input you need to change the line to take character as an input, otherwise space is taken as input in the array.
Here is the solution in which the above 2 modifications were made and submitted which yielded an AC:
https://www.codechef.com/viewsolution/30004342

Thank you…