NEXT PALINDROME

Hi everyone , I wrote the following code : http://www.codechef.com/viewsolution/4333425
for the problem PALIN : http://www.codechef.com/problems/PALIN

I am continuously getting the error SIGSEGV , whereas I am getting absolutely correct output on gcc.
Can anyone be kind enough to point out my mistake ?

Size of s and p could be more than 15 increase that size to 1000001 and I think you won`t get SIGSEGV error .

If you find my answer useful please upvote and accept .

//