Codeforces Round #535 (Div. 3) Nice Garland

  Codeforces Round #535 (Div. 3) Nice Garland

这题之前死活读不懂,看别人代码后,自己写的代码又有错,对照别人代码,半天改不出来!!!真的急,测试数据太坑了,最后还是改好了。

You have a garland consisting of nn lamps. Each lamp is colored red, green or blue. The color of the ii-th lamp is sisi ('R', 'G' and 'B' — colors of lamps in the garland).

You have to recolor some lamps in this garland (recoloring a lamp means changing its initial color to another) in such a way that the obtained garland is nice.

A garland is called nice if any two lamps of the same color have distance divisible by three between them. I.e. if the obtained garland is tt, then for each i,ji,j such that ti=tjti=tj should be satisfied |i−j| mod 3=0|i−j| mod 3=0. The value |x||x| means absolute value of xx, the operation x mod yx mod y means remainder of xx when divided by yy.

For example, the following garlands are nice: "RGBRGBRG", "GB", "R", "GRBGRBG", "BRGBRGB". The following garlands are not nice: "RR", "RGBG".

Among all ways to recolor the initial garland to make it nice you have to choose one with the minimum number of recolored lamps. If there are multiple optimal solutions, print any of them.

Input

The first line of the input contains one integer nn (1≤n≤2⋅1051≤n≤2⋅105) — the number of lamps.

The second line of the input contains the string ss consisting of nn characters 'R', 'G' and 'B' — colors of lamps in the garland.

Output

In the first line of the output print one integer rr — the minimum number of recolors needed to obtain a nice garland from the given one.

In the second line of the output print one string tt of length nn — a nice garland obtained from the initial one with minimum number of recolors. If there are multiple optimal solutions, print any of them.

Examples

Input

3
BRB

Output

1
GRB

Input

7
RGBGRBB

Output

3
RGBRGBR
#include
#include
#include
#include
#include
#include
using namespace std;
const int maxn=2*1e5+10; 
int main()
{
	int len,x,minchange=2*1e5+10;  \\这个数一定要改得很大 超过2*1e10
	char s[maxn];
	char a[6][3]={{'R','B','G'},
				  {'R','G','B'},
				  {'G','R','B'},
				  {'G','B','R'},
				  {'B','R','G'},
				  {'B','G','R'}};
	scanf("%d",&len);
	scanf("%s",s);
	for(int i=0;i<6;i++)
	{
		int change=0;
		for(int j=0;j

 

你可能感兴趣的:(贼坑的题目,暴力枚举)