class Solution:
def isPalindrome(s):
return s == s[::-1]
def longestPalindrome(self, s: str) -> str:
max_length = 0
ans = ''
for i in range(len(s)):
for j in range(i+1, len(s)+1):
temp = s[i:j]
if Solution.isPalindrome(temp) and len(temp) > max_length:
max_length = len(temp)
ans = temp
return ans