6.最长回文子串 leetcode longestPalindrome
class Solution: def longestPalindrome(self, s: str) -> str: def palindrome(s, l, r): while l >= 0 and r < len(s) and s[l] == s[r]: l -= 1 r += 1 return s[l+1:r] .