subpalindrome-3
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

For every string given as input, you need to tell us the number of subsequences of it that are palindromes (need not necessarily be distinct). Note that the empty string is not a palindrome. 

SAMPLE INPUT
1
aab

SAMPLE OUTPUT
4

Explanation

the palindromic subsequences of "aab" are:
"a", "a", "b", "aa", and the method returns 4.