  InterviewBit Academy is now Scaler Academy! # Count Palindromic Subsequences

Given a string A,
find the total number of palindromic subsequences in A % 10^9+7.Palindromic subsequences need not to be distinct. You may assume that the maximum length of A is 1000.

Input Format

``````The only argument given is string A.
``````

Output Format

``````find the total number of palindromic subsequences in A % 10^9+7.Palindromic subsequences need not to be distinct.
``````

Constraints

``````1 <= length( A ) <= 1000
``````

For Example

``````Example 1:

Input 1 :
Output 1:
9
All possible palindromic subsequences :- {"b", "a", "b", "a", "d", "bb", "aa", "bab", "aba"}

Example 2:

Input 2:
"cbbd"
Output 2:
5
All possible palindromic subsequences :- {"c", "b", "b", "d", "bb"}
``````
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details. 