English - January 2020 long challenge

Why my solution is not working even with palindrome?
Solution link: https://www.codechef.com/viewsolution/28802134