PALIN getting WA

Hello everyone ,
I am getting WA for PALIN i have tested with multiple cases . any corner case would be great
Here is my solution
http://www.codechef.com/viewsolution/3930317
Thanks

Try single digit numbers.
for 1 ans is 2
but your output is still 1

figured it out … thanks

still getting wa with http://www.codechef.com/viewsolution/3932618

no clue tried different cases …any ideas

//