goal is to write maximal palindrome substring in functional programming