题干:
The Fair Nut found a string ss. The string consists of lowercase Latin letters. The Nut is a curious guy, so he wants to find the number of strictly increasing sequences p1,p2,…,pkp1,p2,…,pk, such that:
The Nut is upset because he doesn't know how to find the number. Help him.
This number should be calculated modulo 109+7109+7.
Input
The first line contains the string ss (1≤|s|≤1051≤|s|≤105) consisting of lowercase Latin letters.
Output
In a single line print the answer to the problem — the number of such sequences p1,p2,…,pkp1,p2,…,pk modulo 109+7109+7.
Examples
Input
abbaa
Output
5
Input
baaaa
Output
4
Input
agaa
Output
3
Note
In the first example, there are 55 possible sequences. [1][1], [4][4], [5][5], [1,4][1,4], [1,5][1,5].
In the second example, there are 44 possible sequences. [2][2], [3][3], [4][4], [5][5].
In the third example, there are 33 possible sequences. [1][1], [3][3], [4][4].
题目大意:
让你构造一个序列,有两个要求:1.全为‘a’字符。2.每两个a字符之间一定夹着至少一个b字符,求能构造出多少个这样的序列
解题报告:
扫一遍遇到a就记录,遇到b就终止并开始计数 最后输出答案,就行了
AC代码:
#include
#include
#include
#include
#include