Each character (and each pair of adjacent characters) is treated as a potential center of a palindrome. Expand outwards while the characters match. Keep track of the longest palindrome found.