# -*- coding:utf-8 -*-

class Solution:
    def getLongestPalindrome(self, A, n):
        # write code here
        count= []
        flag = 1
        for i in range(1, n+1):
            for j in range(0, n-i+1):
                if A[j:i+j] == A[j:i+j][::-1]:
                    flag = i
                else:continue
            count.append(flag)
        return max(count)