题目描述
Problem Description
Given a string \( S \) consisting of lowercase characters.
The value of a string is defined as the number of distinct non-empty subsequences of the string, where a subsequence can be the string itself.
Calculate the sum of the values of all subsequences of \( S \). The answer should be taken modulo \( 10^9 + 7 \).
Input Format
The first line contains a string \( S \) consisting of lowercase characters.
Output Format
Output a single line containing the answer.
Sample Input and Output
Sample Input #1
ab
Sample Output #1
5
Sample Input #2
sapnap
Sample Output #2
593
Sample Input #3
abcbdabcbabcd
Sample Output #3
938773
Sample Input #4
tobeornottobethatisthequestion
Sample Output #4
769276982
Notes
Data Size and Constraints
This problem uses batched testing.
- Subtask 1 (5 pts): \( |S| \le 11 \).
- Subtask 2 (10 pts): \( |S| \le 22 \).
- Subtask 3 (20 pts): \( |S| \le 100 \) and \( S \) consists only of characters
aandb. - Subtask 4 (30 pts): \( |S| \le 5000 \).
- Subtask 5 (35 pts): No additional constraints.
For \( 100\% \) of the data, \( 1 \le |S| \le 10^6 \), and \( S \) consists only of lowercase characters.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
ab
样例输出
5