Given a string, the task is to count all palindromic sub-strings present in it.
The first line of input will contain no of test cases T . Then T test cases follow . Each test case contains 2 lines. The first line of each test case contains an integer N denoting the length of the string, next line of test case contains the string
For each test case output a single line depecting the number of palindromic substrings present.
Test Case 1
Input : str = "abaab"
All palindrome substring are : "aba" , "aa" , "baab"
Test Case 2
Input : str = "abbaeae"
All palindrome substring are : "bb" , "abba" ,"aea","eae"
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.