getting wrong answer on spoj SUBST1

array
suffix

#1

any one please help me what’s wrong with my solution:https://ideone.com/fVhCSG
its giving WA running perfectly on my maching


#2

who is he?


#3

I think your suffix array construction takes O(n(logn)^2) time. All the best.