Let’s assume you want to solve the PALIN problem (which you should note in your post). Then you should read this thread as your code has got the exactly same problem.