Codeforces Round 472 (rated, Div. 2, based on VK Cup 2018 Round 2)
A
Tritonic Iridescence
Codeforces
1300
原题
←B →
翻译中…

Overlooking the captivating blend of myriads of vernal hues, Arkady the painter lays out a long, long canvas.

翻译中…

Arkady has a sufficiently large amount of paint of three colours: cyan, magenta, and yellow. On the one-dimensional canvas split into $*n*$ consecutive segments, each segment needs to be painted in one of the colours.

翻译中…

Arkady has already painted some (possibly none or all) segments and passes the paintbrush to you. You are to determine whether there are at least two ways of colouring all the unpainted segments so that no two adjacent segments are of the same colour. Two ways are considered different if and only if a segment is painted in different colours in them.

翻译中…

Input

翻译中…

The first line contains a single positive integer $*n*$ ($1 ≤ *n* ≤ 100$) — the length of the canvas.

翻译中…

The second line contains a string $*s*$ of $*n*$ characters, the $*i*$-th of which is either 'C' (denoting a segment painted in cyan), 'M' (denoting one painted in magenta), 'Y' (one painted in yellow), or '?' (an unpainted one).

翻译中…

Output

翻译中…

If there are at least two different ways of painting, output "Yes"; otherwise output "No" (both without quotes).

翻译中…

You can print each character in any case (upper or lower).

翻译中…

Note

翻译中…

For the first example, there are exactly two different ways of colouring: CYCMY and CYMCY.

翻译中…

For the second example, there are also exactly two different ways of colouring: CMCMY and CYCMY.

翻译中…

For the third example, there are four ways of colouring: MCYCM, MCYCY, YCYCM, and YCYCY.

翻译中…

For the fourth example, no matter how the unpainted segments are coloured, the existing magenta segments will prevent the painting from satisfying the requirements. The similar is true for the fifth example.

翻译中…

样例

Input #1
5
CY??Y
Output #1
Yes
InputCopy OutputCopy
Input #2
5
C?C?Y
Output #2
Yes
InputCopy OutputCopy
Input #3
5
?CYC?
Output #3
Yes
InputCopy OutputCopy
Input #4
5
C??MM
Output #4
No
InputCopy OutputCopy
Input #5
3
MMY
Output #5
No
InputCopy OutputCopy
题目信息
题号
957A
时间限制
1 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。