Palindrome

When the string gets reduced to wither a palindrome or empty then the number of character…