Tech Mahindra interview question

palindrome string