String = "ababad"
生成一个程序，可以在给定字符串中找到最长的回文字符串
def longestPallindrome(string):

    #检查字符串是否为空
    if(len(string) == 0):
        return ""

    #定义一个数据结构并储存最长回文字符串的长度
    pallindromes = [[0 for x in range(len(string))] for y in range(len(string))]
    max_length = 0
    start_pos = 0
    #计算最长回文字符串
    for i in range(len(string)):
        pallindromes[i][i] = 1
        for j in range(i):
            if(string[j] == string[i] and (pallindromes[j+1][i-1] or i-j == 1)):
                pallindromes[j][i] = 1
                if(max_length < i - j + 1):
                    max_length = i-j + 1
                    start_pos = j

    return string[start_pos:start_pos+max_length]