问题
It's the year
Choose a position
Farmer John gives Bessie a string
Help Bessie count the number of distinct ways for the number line to be colored while satisfying Farmer John's preferences. Two colorings are different if there is at least one corresponding point with a different color. Because the answer may be large, output it modulo
输入
The first line contains an integer
The following line contains string
输出
Output the number of distinct ways for the number line to be colored while satisfying Farmer John's preferences modulo
子任务
| 编号 | 分数 | 条件 |
|---|---|---|
| #1 | 10分 | |
| #2 | 20分 | |
| #3 | 30分 | All but at most |
| #4 | 40分 | No additional constraints |
示例 #1
6
RXXXXB
5
Bessie can choose
The other colorings are
示例 #2
6
XXRBXX
6
The six colorings are
示例 #3
12
XBXXXXRXRBXX
18