expand that takes two indices left and right and expands outwards while s[left] == s[right].ans to store the bounds of the longest palindrome found.i in the string s.
a. Call expand(i, i) to find the longest odd-length palindrome centered at i.
b. Update ans if a longer palindrome is found.
c. Call expand(i, i + 1) to find the longest even-length palindrome centered at i and i + 1.
d. Update ans if a longer palindrome is found.ans to return the longest palindromic substring.