A challenge was posted recently on LinkedIn to provide an algorithm to determine the longest palindrome in a specified string. It proved to be fairly straightforward to handle the problem in a single line of Mathematica code, as follows: teststring = “ItellyoumadamthecatisnotacivicanimalalthoughtisdeifiedinEgypt”; nlargest = 5; TakeLargestBy[Cases[StringCases[teststring, __, Overlaps -> All], _?PalindromeQ], StringLength, nlargest] // Flatten…