문제
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