Score : $1300$ points
There is a string $s$ consisting of a
and b
.
Snuke can perform the following two kinds of operation any number of times in any order:
aa
as a substring, and replace it with b
.bb
as a substring, and replace it with a
.How many strings $s$ can be obtained by this sequence of operations? Find the count modulo $10^9 + 7$.
a
and b
.Input is given from Standard Input in the following format:
$s$
Print the number of strings $s$ that can be obtained, modulo $10^9 + 7$.
aaaa
6
Six strings can be obtained:
aaaa
aab
aba
baa
bb
a
aabb
5
Five strings can be obtained:
aabb
aaa
bbb
ab
ba
ababababa
1
Snuke cannot perform any operation.
babbabaaba
35