Score : $800$ points
We have a string $S$ of length $N$ consisting of A, B, and C.
You can do the following operation on $S$ zero or more times:
A, B, and C) that is different from both $S_i$ and $S_{i + 1}$, and remove $S_{i + 1}$ from $S$.Find the number of distinct strings that $S$ can be after zero or more operations, and print the count modulo $(10^9+7)$.
A, B, and C.Input is given from Standard Input in the following format:
$N$ $S$
Print the number of distinct strings that $S$ can be after zero or more operations, modulo $(10^9+7)$.
5 ABAAC
11
For example, the following sequence of operations turns $S$ into ACB:
C and remove $S_3$, turning $S$ into ACAC.B and remove $S_4$, turning $S$ into ACB.50 AACCCCBBBACCCCABABCCCCABACCACACACCACABABBBABABACCB
256972022