String Sort Problem

getting run error while submitting the code .
it’s working fine in ide.

@jack_dk the condition in for loop while taking input should be i < n and similarly the sort function should take arr + n as its second argument. I do not understand why you are trying to access the nth index when the array is accessible upto n-1 index only.

@Ishitagambhir i was trying something else anyway i have removed this but still it is giving run error when i am submitting the code

@jack_dk in line 24 (output loop) also you are running it till n, remove the equality sign.