Erlang Example: Find the Maximum Palindrome Length

A palindrome is a string that is equal to its reverse. The problem here is to find the longest part of a given string that is a palindrome. For instance, the answer is 3 for aacbcx, because cbc is a palindrome, and there is no longer instance. The following program is based on the observation that if x>2 is the length of the longest palindrome, then there must also be a palindrome of length x-2 within the same input word.