Given a string s, your task is to determine how many unique non-empty palindromic subsequences can be formed from it.
A subsequence is created by removing zero or more characters without reordering the remaining ones.
A string is considered a palindrome when it reads the same forward and backward.
Two subsequences are treated as different if at least one position contains a different character.
Because the count can become extremely large, return the result modulo 1,000,000,007.
Input: s = "aaa"
Output: 3
Explanation:
The unique palindromic subsequences are: "a", "aa", "aaa".
Input: s = "abca"
Output: 5
Explanation:
Unique palindromic subsequences are: "a", "b", "c", "aa", "aca".
Accepted:
Submission: