54.back to the longest text string is not simple

L = "caayyhheehhbbbhhjhhyyaac"
start, length = 0, 0
for i in range(1,len(L)-1):
    if L[i] == L[i+1]:
        s = min(len(L[:i+1]),len(L[i+1:]))
        a, b = 1, 1
        while a < s:
            if L[i-a] == L[i+1+a]:      # to the left 1 pace, to the right 1 pace
                b += 1                  # use b to calculate length
                if b*2 > length:
                    start = i + 1 - b   # start = left
                    length = b * 2      # length = from left to right
            else:
                break
            a += 1                      # use a to count

    if L[i-1] == L[i+1]:
        s = min(len(L[:i]),len(L[i+1:]))
        a, b = 1, 0
        while a <= s:
            if L[i-a] == L[i+a]:
                b += 1
                if (b*2)+1 > length:
                    start = i - b
                    length = b * 2 + 1
            else:
                break
            a += 1
print L[start:start+length]