'Why does overflow occur in this function when passing an index to slice a string?

I have the following function which counts the number of unique palindromes in a string. I am trying to make the algorithm efficient by keeping track of an index to avoid having to call the sliced string each time in the recursion. However when adding an index parameter to the recursive function cp2 I am getting max calls to the stack. Can someone explain why this is occuring?

def countPalindrones(word, d):
    count = 0

    if word in d:
        return d[word]
    
    if len(word) == 0:
        return 1
    
    for i in range(len(word)):
        if isPalindrone(word[:i+1]):
            count += countPalindrones(word[i+1:], d)
            d[word] = count
    return count

# overflow ???
def cp2(word, index, d):
    count = 0
    
    if word[index:] in d:
        return d[word[index:]]
    
    if len(word[index:]) == 0:
        return 1
    
    for i in range(len(word[index:])):
        if isPalindrone(word[index:][:i+1]):
            count += cp2(word, i + 1, d)
            d[word[index:]] = count
    return count 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source