問題
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