You have a garland consisting of $n$ lamps. Each lamp is colored red, green or blue. The color of the $i$-th lamp is $s_i$ ('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 $t$, then for each $i, j$ such that $t_i = t_j$ should be satisfied $|i-j|~ mod~ 3 = 0$. The value $|x|$ means absolute value of $x$, the operation $x~ mod~ y$ means remainder of $x$ when divided by $y$.

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 $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of lamps.

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


-----Output-----

In the first line of the output print one integer $r$ — 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 $t$ of length $n$ — 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

Difficulty: introductory

Starter code:

Solutions:
starts = ["RGB", "RBG", "BRG", "BGR", "GRB", "GBR"]

N = int(input())
s = input()

min_cost = float("inf")
min_str = ""

for k in starts:
	sp = (k * -(-N // 3))[:N]
	cost = sum(x != y for x, y in zip(s, sp))
	if cost < min_cost:
		min_cost = cost
		min_str = sp

print(min_cost)
print(min_str)

A = ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']
n = int(input())
s = input()
ans = n + 1
f = 0
for i in range(6):
    k = 0
    for j in range(n):
        if s[j] != A[i][j % 3]:
            k += 1
    if k < ans:
        ans = k
        f = i
print(ans)
for i in range(n):
    print(A[f][i % 3], end="")

n = int(input())
arr = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
s = input()
cnts = []
for i in arr:
    cnt = 0
    for j in range(len(s)):
        if s[j] == i[j % 3]:
            cnt += 1
    cnts.append(cnt)
k = cnts.index(max(cnts))
s = arr[k] * (n // 3 + 1)
s = s[:n]
print(n - max(cnts))
print(s)

n = int(input())
s = input().strip()
best, ans = n, None
for p in ('RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR'):
    t = p * ((n + 2) // 3)
    c = sum(x != y for x, y in zip(s, t))
    if c < best:
        best = c
        ans = t[:n]
print(best, ans, sep='\n')

from itertools import permutations

n = int(input())
seq = input()

ls = list(permutations("RGB"))
for i in range(len(ls)):
    ls[i] = ''.join(ls[i])

strans = ""
ans = n
for tes in ls:
    tes = (tes * (n // 3 + 1))
    cur = 0
    for i in range(len(seq)):
        if tes[i] != seq[i]:
            cur += 1
    if cur < ans:
        ans = min(ans, cur)
        strans = tes[:len(seq)]
    # print(tes, seq, ans, cur)
print(ans)
print(strans)


import itertools
N = int(input())
Color = input()
ans = float('inf')
for c in itertools.permutations(('R', 'G', 'B')):
    ctr = 0
    for i, v in enumerate(Color):
        if c[i%3] != v:
            ctr += 1
    if ctr < ans:
        ans = ctr
        Ans = ''.join([c[i%3] for i in range(N)])
print(ans)
print(Ans)

n = int(input())

s = input()

G = ['GRB','GBR','RBG','RGB','BGR','BRG']

best = 10**10
guy = None

for i in G:
    temp = 0
    for j in range(n):
        if s[j] != i[j%3]:
            temp += 1
    if temp < best:
        best = temp
        guy = i

print(best)
print(guy*(n//3)+guy[:n%3])



n=int(input())
s=input()
lens=len(s)
ans,ans2=10**9,""

for ca in range(6):
    if 0<=ca<=1:
        st="R"
    elif 2<=ca<=3:
        st="G"
    else:
        st="B"

    ss=[0]*lens
    for i in range(lens):
        ss[i]=st
        if st=="R":
            if ca%2==0: st="G"
            else: st="B"
        elif st=="G":
            if ca%2==0: st="B"
            else: st="R"
        else:
            if ca%2==0: st="R"
            else: st="G"

    diff=0
    for i in range(lens):
        if ss[i]!=s[i]: diff+=1

    if diff<ans:
        ans,ans2=diff,"".join(ss)

print(ans,ans2,sep="\n")

import itertools
n = int(input())
s = input()
best_pattern = None
best_count = None
for pattern in itertools.permutations("RGB", 3):
    count = 0
    for i, ch in enumerate(s):
        if ch != pattern[i % 3]:
            count += 1
    if best_count is None or best_count > count:
        best_count, best_pattern = count, pattern

print(best_count)
full, tail = divmod(n, 3)
print("".join(best_pattern * full + best_pattern[:tail]))


import itertools

n = int(input())
lamps = input()

perms = itertools.permutations(['R', 'G', 'B'])
best = n
for p in perms:
    recolors = 0
    for i in range(n):
        if lamps[i] != p[i%3]:
            recolors += 1
    if recolors < best:
        best = recolors
        bestp = p

print(best)
print(''.join(itertools.islice(itertools.cycle(bestp), n)))



n = int(input())
s = input()
x = []
x2 = []
y = []
y2 = []
z = []
z2 = []
a = 0
while a<n:
    if a% 3 == 0:
        x.append("G")
    elif a%3 == 1:
        x.append("B")
    else:
        x.append("R")
    a += 1
a = 0
while a<n:
    if a% 3 == 0:
        x2.append("G")
    elif a%3 == 1:
        x2.append("R")
    else:
        x2.append("B")
    a += 1
a = 0
while a<n:
    if a% 3 == 0:
        y.append("B")
    elif a%3 == 1:
        y.append("G")
    else:
        y.append("R")
    a += 1
a = 0
while a<n:
    if a% 3 == 0:
        y2.append("B")
    elif a%3 == 1:
        y2.append("R")
    else:
        y2.append("G")
    a += 1
a = 0
while a<n:
    if a% 3 == 0:
        z.append("R")
    elif a%3 == 1:
        z.append("G")
    else:
        z.append("B")
    a += 1
a = 0
while a<n:
    if a% 3 == 0:
        z2.append("R")
    elif a%3 == 1:
        z2.append("B")
    else:
        z2.append("G")
    a += 1
ans = float("inf")
dore = [x,x2,y,y2,z,z2]
d = 0
tmp = 0
for i in range(n):
    if x[i] != s[i]:
        tmp += 1
if tmp < ans:
    d = 0
    ans = tmp
tmp = 0
for i in range(n):
    if x2[i] != s[i]:
        tmp += 1
if tmp < ans:
    d = 1
    ans = tmp

tmp = 0
for i in range(n):
    if y[i] != s[i]:
        tmp += 1
if tmp < ans:
    d = 2
    ans = tmp
tmp = 0
for i in range(n):
    if y2[i] != s[i]:
        tmp += 1
if tmp < ans:
    d = 3
    ans = tmp

tmp = 0
for i in range(n):
    if z[i] != s[i]:
        tmp += 1
if tmp < ans:
    d = 4
    ans = tmp
tmp = 0
for i in range(n):
    if z2[i] != s[i]:
        tmp += 1
if tmp < ans:
    d = 5
    ans = tmp
print(ans)
print("".join(dore[d]))

n=int(input())
s=input()
perm=["RGB","RBG","BRG","BGR","GRB","GBR"]
ans=0

ans=10**9
p=""
for i in range(len(perm)):
    temp=0
    a=""
    for j in range(n):
        if s[j]!=perm[i][j%3]:
            temp+=1
            a+=perm[i][j%3]
        else:
            a+=s[j]
    if temp<ans:
        ans=temp
        p=a
print(ans)
print(p)

    


n = int(input())
g = input()
variants = [['R', 'G', 'B'], ['R', 'B', 'G'], ['G', 'R', 'B'], ['G', 'B', 'R'], ['B', 'R', 'G'], ['B', 'G', 'R']]

best_cost = n
best = None
for v in variants:
    cost = 0
    for i in range(n):
        if g[i] != v[i%3]: cost += 1
    if cost < best_cost:
        best_cost = cost
        best = v
        
print(best_cost)
for i in range(n):
    print(best[i % 3], end='')
    
print()


n = int(input())
s = input()

R = [0,0,0]
G = [0,0,0]
B = [0,0,0]

L = ["RGB", "RBG", "BRG", "BGR", "GBR", "GRB"]

for i in range(n):
    if s[i] == "R":
        R[i%3] += 1
    if s[i] == "G":
        G[i%3] += 1
    if s[i] == "B":
        B[i%3] += 1
    
mi = 10**9
for l in L:
    dif = 0
    for i in range(3):
        if l[i] == "R":
            dif += G[i] + B[i]
        elif l[i] == "G":
            dif += R[i] + B[i]
        else:
            dif += R[i] + G[i]
        
    if dif < mi:
        mi = dif
        tmp = l
        
print(mi)
print((tmp*((n+10)//3))[:n])



def diffs(s1, s2):
  c=0
  for i, j in zip(s1, s2):
    if not i==j:
      c+=1
  return c

n=int(input())
i_s=input()
chk=int(n/3)+1
sl=["RGB", "RBG", "BRG", "BGR", "GBR", "GRB"]
ol=list(map(lambda x: (x*chk)[:n], sl))
dl=list(map(lambda x: diffs(x, i_s), ol))
print(min(dl))
print(ol[dl.index(min(dl))])

n = int(input())
s = input()
mask = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
ans = 10000000000
anss = ''
for i in range(6):
    k = n // 3
    ss = mask[i] * k + mask[i][:n % 3]
    now = 0
    for j in range(n):
        if s[j] != ss[j]:
            now += 1
    if now < ans:
        ans = now
        anss = ss

print(ans)
print(anss)
    


n = int(input())
s = input()
baz = ['RGB','RBG','GBR', 'GRB', 'BRG', 'BGR']
for i in range(len(baz)):
    baz[i] = (baz[i] * n)[0:n]
ans = 10 ** 9
text = baz[0]
for i in baz:
    ch = 0
    for j in range(n):
        if s[j] != i[j]:
            ch += 1
    if ch < ans:
        text = i
    ans = min(ans, ch)
print(ans)
print(text)

n = int(input())
s = input()
best = -1
ans = 10 ** 6
per = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
for idx, p in enumerate(per):
	tmp = 0
	for i in range(n):
		if s[i] != p[i % 3]:
			tmp += 1
	if tmp < ans:
		ans = tmp
		best = idx
out = per[best] * (n // 3) + per[best][:(n % 3)]
print(ans)
print(out)

#      
import collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    

try :
    #raise ModuleNotFoundError
    import numpy
    def dprint(*args, **kwargs):
        #print(*args, **kwargs, file=sys.stderr)
        # in python 3.4 **kwargs is invalid???
        print(*args,  file=sys.stderr)
    dprint('debug mode')
except Exception:
    def dprint(*args, **kwargs):
        pass



inId = 0
outId = 0
if inId>0:
    dprint('use input', inId)
    try:
        f = open('input'+ str(inId) + '.txt', 'r')
        sys.stdin = f #标准输出重定向至文件
    except Exception:
        dprint('invalid input file')
if outId>0:
    dprint('use output', outId)
    try:
        f = open('stdout'+ str(outId) + '.txt', 'w')
        sys.stdout = f #标准输出重定向至文件
    except Exception:
        dprint('invalid output file')
        
    atexit.register(lambda :sys.stdout.close())     #idle 中不会执行 atexit
    
N, = getIntList()
#print(N)
S = input()

s0 = 'RGB' * 100000
s1 = 'RBG' * 100000
s2 = 'BRG' * 100000
s3 = 'BGR' * 100000
s4 = 'GRB' * 100000
s5 = 'GBR' * 100000

zs = [s0,s1,s2,s3,s4,s5]
zr = []
for x in zs:
    t = 0
    for i in range(N):
        if x[i] != S[i]:
            t+=1
    zr.append(t)

r = min(zr)
dprint(r)
for i in range(6):
    if zr[i] == r:
        print(r)
        print(zs[i][:N])
        break







n = int(input())
s = input()
if len(s) <= 2 and len(set(s)) > 1:
    print(0)
    print(s)
elif len(s) == 2:
    print(1)
    bam = 'RGB'
    print(s[0]+bam[(bam.index(s[0])+1)%3])
else:
    o1 = {'R': 0, 'G': 0, 'B': 0}
    o2 = {'R': 0, 'G': 0, 'B': 0}
    o3 = {'R': 0, 'G': 0, 'B': 0}
    for t in range(len(s)):
        if t%3 == 0:
            o1[s[t]] += 1
        elif t%3 == 1:
            o2[s[t]] += 1
        else:
            o3[s[t]] += 1
    m1 = 0
    kwek = ''
    for girl in ('RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR'):
        z = o1[girl[0]]+o2[girl[1]]+o3[girl[2]]
        if z > m1:
            m1 = z
            kwek = girl
    print(len(s) - m1)
    for t in range(len(s)):
        print(kwek[t%3], end='')


n=int(input())
s=input()
c=['RGB','RBG','GRB','GBR','BRG','BGR']
ans=10**9
ss=''
for base in c:
	x=base*(len(s)//3+1)
	t=0
	for j in range(len(s)):
		if s[j]!=x[j]:t+=1
	if t<ans:
		ans=t
		ss=x[:len(s)]
print(ans)
print(ss)


f=["R","G","B"]
n=int(input())
s=input()
b=n*[0]
for i in range(len(s)):
    if s[i]=="R":
        b[i]=0
    elif s[i]=="G":
        b[i]=1
    else:
        b[i]=2
d=[[0,1,2],[0,2,1],[1,0,2],[1,2,0],[2,0,1],[2,1,0]]
r=[]
for i in range(len(d)):
    g=0
    for j in range(len(b)):
        if b[j]!=d[i][j%3]:
            g+=1
    r+=[g]
    if g==0:
        break
p=min(r)
e=d[r.index(p)]
print(p)
q=''
for i in range(n):
    q+=f[e[i%3]]
print(q)


# -*- coding: utf-8 -*-
# @Time    : 2019/1/23 22:56
# @Author  : LunaFire
# @Email   : gilgemesh2012@gmail.com
# @File    : C. Nice Garland.py


def main():
    n = int(input())
    s = input()

    patterns = ['RGB', 'RBG', 'BGR', 'BRG', 'GRB', 'GBR']

    recolor_count = n + 1
    nice_pattern = None
    for p in patterns:
        curr_count = 0
        for i in range(n):
            if s[i] != p[i % 3]:
                curr_count += 1
        if curr_count < recolor_count:
            recolor_count = curr_count
            nice_pattern = p

    print(recolor_count)
    for i in range(n):
        print(nice_pattern[i % 3], end='')
    print()


def __starting_point():
    main()

__starting_point()

n=int(input())
s=list(input())
m=n//3
m+=1
a=list("GRB")
a=a*m
a=a[:n]
a1=list("GBR")
a1=a1*m
a1=a1[:n]
a2=list("RBG")
a2=a2*m
a2=a2[:n]
a3=list("RGB")
a3=a3*m
a3=a3[:n]
a4=list("BRG")
a4=a4*m
a4=a4[:n]
a5=list("BGR")
a5=a5*m
a5=a5[:n]
ans=[]
d=0
for i in range(n):
    if a[i]!=s[i]:
        d+=1
ans.append([d,0])
d=0
for i in range(n):
    if a1[i]!=s[i]:
        d+=1
ans.append([d,1])
d=0
for i in range(n):
    if a2[i]!=s[i]:
        d+=1
ans.append([d,2])
d=0
for i in range(n):
    if a3[i]!=s[i]:
        d+=1
ans.append([d,3])
d=0
for i in range(n):
    if a4[i]!=s[i]:
        d+=1
ans.append([d,4])
d=0
for i in range(n):
    if a5[i]!=s[i]:
        d+=1
ans.append([d,5])
ans.sort()
if ans[0][1]==0:
    print(ans[0][0])
    print(''.join(a))
elif ans[0][1]==1:
    print(ans[0][0])
    print(''.join(a1))
elif ans[0][1]==2:
    print(ans[0][0])
    print(''.join(a2))
elif ans[0][1]==3:
    print(ans[0][0])
    print(''.join(a3))
elif ans[0][1]==4:
    print(ans[0][0])
    print(''.join(a4))
elif ans[0][1]==5:
    print(ans[0][0])
    print(''.join(a5))