getting wrong answer on spoj SUBST1

any one please help me what’s wrong with my solution:fVhCSG - Online C++ Compiler & Debugging Tool - Ideone.com
its giving WA running perfectly on my maching

who is he?

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