Codeforces Round 738 (Div. 2)
B
Mocha and Red and Blue
Codeforces
900
原题
← AC →
翻译中…

As their story unravels, a timeless tale is told once again...

翻译中…

Shirahime, a friend of Mocha's, is keen on playing the music game Arcaea and sharing Mocha interesting puzzles to solve. This day, Shirahime comes up with a new simple puzzle and wants Mocha to solve them. However, these puzzles are too easy for Mocha to solve, so she wants you to solve them and tell her the answers. The puzzles are described as follow.

翻译中…

There are $n$ squares arranged in a row, and each of them can be painted either red or blue.

翻译中…

Among these squares, some of them have been painted already, and the others are blank. You can decide which color to paint on each blank square.

翻译中…

Some pairs of adjacent squares may have the same color, which is imperfect. We define the imperfectness as the number of pairs of adjacent squares that share the same color.

翻译中…

For example, the imperfectness of "BRRRBBR" is $3$, with "BB" occurred once and "RR" occurred twice.

翻译中…

Your goal is to minimize the imperfectness and print out the colors of the squares after painting.

翻译中…

Input

翻译中…

Each test contains multiple test cases.

翻译中…

The first line contains a single integer $t$ ($1 \le t \le 100$) — the number of test cases. Each test case consists of two lines.

翻译中…

The first line of each test case contains an integer $n$ ($1\leq n\leq 100$) — the length of the squares row.

翻译中…

The second line of each test case contains a string $s$ with length $n$, containing characters 'B', 'R' and '?'. Here 'B' stands for a blue square, 'R' for a red square, and '?' for a blank square.

翻译中…

Output

翻译中…

For each test case, print a line with a string only containing 'B' and 'R', the colors of the squares after painting, which imperfectness is minimized. If there are multiple solutions, print any of them.

翻译中…

Note

翻译中…

In the first test case, if the squares are painted "BRRBRBR", the imperfectness is $1$ (since squares $2$ and $3$ have the same color), which is the minimum possible imperfectness.

翻译中…

样例

Input #1
5
7
?R???BR
7
???R???
1
?
1
B
10
?R??RB??B?
Output #1
BRRBRBR
BRBRBRB
B
B
BRRBRBBRBR
InputCopy OutputCopy
题目信息
题号
1559B
时间限制
1 s
内存限制
256 MB
标签
动态规划
贪心

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