P21670 [GeeksforGeeks] Count palindrome sub strings of a string0652
普及
题目描述

Given a string, the task is to count all palindromic sub-strings present in it. Length of palindrome sub-string must be greater than or equal to 2.
Example
Input
N = 5
str = "abaab"
Output
3
Explanation:
All palindrome substring are : "aba" , "aa" , "baab"
Example
Input
N = 7
str = "abbaeae"
Output
4
Explanation:
All palindrome substring are : "bb" , "abba" ,"aea",
"eae"
Expected Time Complexity : O(|S|^{2})
Expected Auxilliary Space : O(|S|^{2})
Constraints:
2<=|S|<=500

输入格式

见题面

输出格式

见题面

样例输入
N = 5 str = "abaab"
样例输出
3