Palin : Code is accepted in SPOJ but getting TLE on CodeChef.

My code of Palin is accepted in Spoj but giving TLE in CodeChef. Please suggest and help me reducing the running time of the code.

Thanks in advance.

//