Problem Link: https://uva.onlinejudge.org/external/12/1223.pdf
My implementation: http://ideone.com/bLGTpc
Verdict: WA
Anyone please help me to figure out my mistake. I learned Suffix Array today and this is my first implementation. Any help is really appreciated.