BETA

#### Submissions: 1218 Accuracy: 44.25%

Count Palindrome Sub-Strings of a String

Given a string, the task is to count all palindromic sub-strings present in it.

Input:

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

Output:

For each test case output a single line depecting the number of palindromic substrings present.

Constraints:

1<=T<=100
2<=N<=500

Example:

Input

2
5
abaab
7
abbaeae

Output

3
4

Explanation:

Test Case 1
Input : str = "abaab"
Output: 3
All palindrome substring are : "aba" , "aa" , "baab"

Test Case 2
Input : str = "abbaeae"
Output: 4
All palindrome substring are : "bb" , "abba" ,"aea","eae"

#### ** For More Input/Output Examples Use 'Expected Output' option **

##### It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result: