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

Source: codeforces | Difficulty: EASY
Tags: Complete search

Mathematics

Greedy algorithms


Solutions:
import math
n = int(input())
s = input()
combination = ('RGB', 'RBG', 'GRB', 'GBR', 'BGR', 'BRG')
summa = [0, 0, 0, 0, 0, 0]

def diff(input, pattern):
	count = 0
	if len(input) == 1:
		if input[0] != pattern[0]:
			count += 1
		return count
	elif len(input) == 2:
		if input[0] != pattern[0]:
			count += 1
		if input[1] != pattern[1]:
			count += 1
		return count
	else:
		if input[0] != pattern[0]:
			count += 1
		if input[1] != pattern[1]:
			count += 1
		if input[2] != pattern[2]:
			count += 1
		return count
number_of_ut = 0
number_of_ut = len(s) // 3
for i in range(number_of_ut):
	tmp = s[3 * i:3 * (i + 1)]
	for i in range(len(combination)):
		summa[i] += diff(tmp, combination[i])
ostatok = len(s) - number_of_ut * 3
if ostatok > 0:
	tmp = s[len(s) - ostatok:]
	for i in range(len(combination)):
		summa[i] += diff(tmp, combination[i])
best_comb = combination[summa.index(min(summa))]
ans = ''
for i in range(number_of_ut):
	ans += best_comb
ans += best_comb[:ostatok]
print(summa[summa.index(min(summa))])
print(ans)


t = int(input())
s = input()
a = ['RGB', 'RBG', 'GBR', 'GRB', 'BRG', 'BGR']
l = {}
for i in a:
	count = 0
	cost = 0
	hell = ''
	for j in range(0, t):
		if count % 3 == 0:
			count = 0
		if s[j] != i[count]:
			cost += 1
		hell += i[count]
		count += 1
	l[cost] = hell
print(min(l))
print(l[min(l)])


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
n = int(input())
s = [*input(), 0]
m = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		m += 1
		s[i] = (set('RGB') - set(s[i:i + 2])).pop()
print(m)
print(''.join(s[:-1]))


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


n = int(input())
s = list(input())
a = 'RGB'
if n == 1:
	print(0)
	print(s[0])
	from sys import exit
	exit()
cost = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		for c in a:
			if s[i - 1] != c and (i < n - 1 and c != s[i + 1]):
				s[i] = c
				cost += 1
				break
if s[-1] == s[-2]:
	for c in a:
		if c != s[-2]:
			s[-1] = c
			cost += 1
			break
print(cost)
print(''.join(s))


n = int(input())
s = input()
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if s[0] == s[1] == 'B':
		print(1)
		print('RB')
	elif s[0] == s[1] == 'R':
		print(1)
		print('BR')
	elif s[0] == s[1] == 'G':
		print(1)
		print('GR')
	else:
		print(0)
		print(s)
else:
	string = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
	ans = []
	if n % 3 == 1:
		s += 'HH'
	elif n % 3 == 2:
		s += 'H'
	for i in range(6):
		cnt = 0
		for j in range(0, n, 3):
			if s[j] != string[i][0]:
				cnt += 1
			if s[j + 1] != string[i][1]:
				cnt += 1
			if s[j + 2] != string[i][2]:
				cnt += 1
		if n % 3 != 0:
			ans.append(cnt - (3 - n % 3))
		else:
			ans.append(cnt)
	print(min(ans))
	print(string[ans.index(min(ans))] * (n // 3) + string[ans.index(min(ans))][:n % 3])


n = int(input())
s = input()
needcnt = n + 1
s1 = ''
s2 = ''
s3 = ''
s4 = ''
s5 = ''
s6 = ''
for i in range(0, n, 3):
	s1 += 'GBR'
	s2 += 'GRB'
	s3 += 'RGB'
	s4 += 'RBG'
	s5 += 'BGR'
	s6 += 'BRG'
s1 += 'GBR'[:n % 3]
s2 += 'GRB'[:n % 3]
s3 += 'RGB'[:n % 3]
s4 += 'RBG'[:n % 3]
s5 += 'BGR'[:n % 3]
s6 += 'BRG'[:n % 3]
lst = [s1, s2, s3, s4, s5, s6]
needs = ''
for i in range(6):
	cnt = 0
	for j in range(n):
		if s[j] != lst[i][j]:
			cnt += 1
	if needcnt > cnt:
		needcnt = cnt
		needs = lst[i]
print(needcnt)
print(needs[0:n])


n = int(input())
strr = list(input())
back = ''
colors = ['R', 'G', 'B']
cc = 0
for i in range(0, n):
	colors = ['R', 'G', 'B']
	if i >= 0 and i + 1 < n:
		back = strr[i - 1]
		current = strr[i]
		nextt = strr[i + 1]
		nk = ''
		if nextt == current:
			if i + 2 < n:
				nk = strr[i + 2]
				if nk in colors:
					colors.remove(nk)
			if nextt in colors:
				colors.remove(nextt)
			strr[i + 1] = colors[0]
			cc += 1
str1 = ''.join(strr)
print(cc)
print(str1)


n = int(input())
s = list(input())
ans = int()
if n == 2:
	if s[0] == s[1]:
		e = set('RGB')
		ans = 1
		e.remove(s[0])
		s[1] = e.pop()
elif n > 2:
	for i in range(1, n - 1):
		k = s[i]
		pr = s[i - 1]
		ne = s[i + 1]
		e = set('RGB')
		if pr == k:
			ans += 1
			if pr == ne:
				e.remove(k)
				s[i] = e.pop()
			else:
				e.remove(pr)
				e.remove(ne)
				s[i] = e.pop()
	if s[n - 1] == s[n - 2]:
		e = set('RGB')
		ans += 1
		e.remove(s[n - 1])
		s[n - 1] = e.pop()
print(ans)
print(''.join(s))


n = int(input())
s = input()
temp = s
s = []
s.append('*')
for i in temp:
	s.append(i)
s.append('*')
c = 0
for i in range(n):
	if s[i] == s[i + 1]:
		if 'R' != s[i] and 'R' != s[i + 2]:
			s[i + 1] = 'R'
		elif 'G' != s[i + 2] and 'G' != s[i]:
			s[i + 1] = 'G'
		elif 'B' != s[i + 2] and 'B' != s[i]:
			s[i + 1] = 'B'
		c += 1
print(c)
for i in range(1, n + 1):
	print(s[i], end='')


n = int(input())
m = list(input())
q = 0
gg = 0
if n % 3:
	q = 1
if n % 3 == 2:
	gg = 1
R = [0, 0, 0]
G = [0, 0, 0]
B = [0, 0, 0]
for i in range(0, n, 3):
	if m[i] == 'R':
		R[0] += 1
	elif m[i] == 'G':
		G[0] += 1
	else:
		B[0] += 1
for i in range(1, n, 3):
	if m[i] == 'R':
		R[1] += 1
	elif m[i] == 'G':
		G[1] += 1
	else:
		B[1] += 1
for i in range(2, n, 3):
	if m[i] == 'R':
		R[2] += 1
	elif m[i] == 'G':
		G[2] += 1
	else:
		B[2] += 1
sr = sum(R)
sg = sum(G)
sb = sum(B)
a = []
a.append(R[0] + B[1] + G[2])
a.append(R[0] + B[2] + G[1])
a.append(R[1] + B[0] + G[2])
a.append(R[1] + B[2] + G[0])
a.append(R[2] + B[0] + G[1])
a.append(R[2] + B[1] + G[0])
k = a.index(max(a))
print(n - max(a))
if k == 0:
	print('RBG' * (n // 3) + 'R' * q + 'B' * gg)
elif k == 1:
	print('RGB' * (n // 3) + 'R' * q + 'G' * gg)
elif k == 2:
	print('BRG' * (n // 3) + 'B' * q + 'R' * gg)
elif k == 3:
	print('GRB' * (n // 3) + 'G' * q + 'R' * gg)
elif k == 4:
	print('BGR' * (n // 3) + 'B' * q + 'G' * gg)
elif k == 5:
	print('GBR' * (n // 3) + 'G' * q + 'B' * gg)


I = lambda : int(input())
IL = lambda : list(map(int, input().split()))
IF = lambda : list(map(float, input().split()))
n = I()
G = list(input() + ' ')
i = 0
r = 0
last = ''
ans = 0
while i <= n:
	if last == G[i]:
		r += 1
		if r == 2:
			G[i - 1] = list(set('RGB') - {G[i], G[i - 2]})[0]
			ans += 1
			r = 0
	elif r:
		G[i - 1] = list(set('RGB') - {G[i], G[i - 2]})[0]
		ans += 1
		r = 0
	last = G[i]
	i += 1
print(ans)
print(''.join(G[:-1]))


n = int(input())
f = input()
if n == 1:
	print('0\n{}'.format(f))
else:
	possible = ('RGB', 'RBG', 'BGR', 'BRG', 'GRB', 'GBR')
	(min_, winner) = (float('inf'), None)
	for poss in possible:
		tot = 0
		(mod_0, mod_1, mod2) = [char for char in poss]
		mp = {0: mod_0, 1: mod_1, 2: mod2}
		for (i, e) in enumerate(f):
			if mp[i % 3] != e:
				tot += 1
		if tot < min_:
			min_ = tot
			winner = poss
	print(f'{min_}\n{winner * (n // 3) + winner[:n % 3]}')


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()
main()


x = int(input())
s = list(input())
res = 0
for n in range(x - 2, -1, -1):
	if s[n] == s[n + 1]:
		if s[n + 1] == 'G':
			s[n] = 'B'
		elif s[n + 1] == 'B':
			s[n] = 'R'
		elif s[n + 1] == 'R':
			s[n] = 'G'
		if n:
			if s[n - 1] == s[n]:
				if s[n - 1] == 'R':
					s[n] = 'G'
				elif s[n - 1] == 'G':
					s[n] = 'B'
				else:
					s[n] = 'R'
		res += 1
print(res)
for n in s:
	print(n, end='')


n = int(input())
s = input()
a = [0, 0, 0]
b = [0, 0, 0]
c = [0, 0, 0]
for i in range(int(n / 3)):
	if s[3 * i] == 'R':
		a[0] += 1
	elif s[3 * i] == 'B':
		a[1] += 1
	elif s[3 * i] == 'G':
		a[2] += 1
	if s[3 * i + 1] == 'R':
		b[0] += 1
	elif s[3 * i + 1] == 'B':
		b[1] += 1
	elif s[3 * i + 1] == 'G':
		b[2] += 1
	if s[3 * i + 2] == 'R':
		c[0] += 1
	elif s[3 * i + 2] == 'B':
		c[1] += 1
	elif s[3 * i + 2] == 'G':
		c[2] += 1
for i in range(n % 3):
	if s[3 * int(n / 3) + i] == 'R':
		if i % 3 == 0:
			a[0] += 1
		elif i % 3 == 1:
			b[0] += 1
		elif i % 3 == 2:
			c[0] += 1
	elif s[3 * int(n / 3) + i] == 'B':
		if i % 3 == 0:
			a[1] += 1
		elif i % 3 == 1:
			b[1] += 1
		elif i % 3 == 2:
			c[1] += 1
	elif s[3 * int(n / 3) + i] == 'G':
		if i % 3 == 0:
			a[2] += 1
		elif i % 3 == 1:
			b[2] += 1
		elif i % 3 == 2:
			c[2] += 1
x = [0, 0, 0, 0, 0, 0]
x[0] = a[0] + b[1] + c[2]
x[1] = a[1] + b[2] + c[0]
x[2] = a[2] + b[0] + c[1]
x[3] = a[0] + b[2] + c[1]
x[4] = a[2] + b[1] + c[0]
x[5] = a[1] + b[0] + c[2]
q = max(x)
print(n - q)
l = x.index(q)
if l == 0:
	print('RBG' * int(n / 3), end='')
	if n % 3 == 1:
		print('R')
	elif n % 3 == 2:
		print('RB')
elif l == 1:
	print('BGR' * int(n / 3), end='')
	if n % 3 == 1:
		print('B')
	elif n % 3 == 2:
		print('BG')
elif l == 2:
	print('GRB' * int(n / 3), end='')
	if n % 3 == 1:
		print('G')
	elif n % 3 == 2:
		print('GR')
elif l == 3:
	print('RGB' * int(n / 3), end='')
	if n % 3 == 1:
		print('R')
	elif n % 3 == 2:
		print('RG')
elif l == 4:
	print('GBR' * int(n / 3), end='')
	if n % 3 == 1:
		print('G')
	elif n % 3 == 2:
		print('GB')
elif l == 5:
	print('BRG' * int(n / 3), end='')
	if n % 3 == 1:
		print('B')
	elif n % 3 == 2:
		print('BR')


input()
s = input()
colors = set(['R', 'G', 'B'])
r = 0
ss = s[0]
for (i, c) in enumerate(s[1:-1], 1):
	if c == ss[-1]:
		r += 1
		ss += (colors - set([ss[-1], s[i + 1]])).pop()
	else:
		ss += c
if len(s) > 1:
	if s[-1] == ss[-1]:
		r += 1
		ss += (colors - set([ss[-1]])).pop()
	else:
		ss += s[-1]
print(r)
print(ss)


len = int(input())
a = input()
sum = 0
b = []
c = 0
for i in range(0, len - 1):
	if c == 1:
		c = 0
		continue
	b.append(a[i])
	if a[i] == a[i + 1]:
		sum += 1
		if i == len - 2:
			if a[i] == 'R':
				c = 2
				b.append('B')
			elif a[i] == 'G':
				b.append('B')
				c = 2
			else:
				c = 2
				b.append('R')
			break
		elif a[i] != 'R' and a[i + 2] != 'R':
			c = 1
			b.append('R')
		elif a[i] != 'G' and a[i + 2] != 'G':
			c = 1
			b.append('G')
		else:
			c = 1
			b.append('B')
print(sum)
for i in b:
	print(i, end='')
if c != 2:
	print(a[len - 1])
else:
	print()


n = int(input())
s = list(input())
sr1 = 0
sb1 = 0
sg1 = 0
sr2 = 0
sb2 = 0
sg2 = 0
sr3 = 0
sb3 = 0
sg3 = 0
x = 3 - n % 3
for i in range(x):
	s.append('a')
for i in range(0, n, 3):
	if s[i] == 'R':
		sr1 += 1
	elif s[i] == 'B':
		sb1 += 1
	elif s[i] == 'G':
		sg1 += 1
	if s[i + 1] == 'R':
		sr2 += 1
	elif s[i + 1] == 'B':
		sb2 += 1
	elif s[i + 1] == 'G':
		sg2 += 1
	if s[i + 2] == 'R':
		sr3 += 1
	elif s[i + 2] == 'B':
		sb3 += 1
	elif s[i + 2] == 'G':
		sg3 += 1
ans = []
ans.append(n - sb1 - sg2 - sr3)
ans.append(n - sb1 - sr2 - sg3)
ans.append(n - sr1 - sg2 - sb3)
ans.append(n - sr1 - sb2 - sg3)
ans.append(n - sg1 - sr2 - sb3)
ans.append(n - sg1 - sb2 - sr3)
print(min(ans))
x = 3 - x
ind = ans.index(min(ans))
if ind == 0:
	for i in range(n // 3):
		print('BGR', end='')
	if x == 1:
		print('B')
	elif x == 2:
		print('BG')
elif ind == 1:
	for i in range(n // 3):
		print('BRG', end='')
	if x == 1:
		print('B')
	elif x == 2:
		print('BR')
elif ind == 2:
	for i in range(n // 3):
		print('RGB', end='')
	if x == 1:
		print('R')
	elif x == 2:
		print('RG')
elif ind == 3:
	for i in range(n // 3):
		print('RBG', end='')
	if x == 1:
		print('R')
	elif x == 2:
		print('RB')
elif ind == 4:
	for i in range(n // 3):
		print('GRB', end='')
	if x == 1:
		print('G')
	elif x == 2:
		print('GR')
elif ind == 5:
	for i in range(n // 3):
		print('GBR', end='')
	if x == 1:
		print('G')
	elif x == 2:
		print('GB')


input()
data = input()
patterns = ('RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR')

def dist(s, p):
	return sum((1 for (i, c) in enumerate(s) if p[i % 3] != c))
ds = [(dist(data, p), p) for p in patterns]
(n, p) = min(ds)
print(n)
print((p * (len(data) // 3 + 3))[:len(data)])


def toChange(colourCount, colour):
	if colour == 0:
		return colourCount[1] + colourCount[2]
	elif colour == 1:
		return colourCount[0] + colourCount[2]
	elif colour == 2:
		return colourCount[1] + colourCount[0]
	else:
		print('DIFFERENTERROR')

def colourMaker(colourOrder, string, n):
	for i in range(n):
		string[i] = colourOrder[i % 3]
	return ''.join(string)
n = int(input())
s = list(str(input()))
rgbCount = []
for z in range(0, 3):
	current = [0, 0, 0]
	while z < n:
		if s[z] == 'R':
			current[0] += 1
		elif s[z] == 'G':
			current[1] += 1
		elif s[z] == 'B':
			current[2] += 1
		else:
			print('ERRORRRRRRRRRRRRRRRRRRRRRRRRRRR')
		z += 3
	rgbCount.append(current)
while len(rgbCount) < 3:
	rgbCount.append([0, 0, 0])
rgb = toChange(rgbCount[0], 0) + toChange(rgbCount[1], 1) + toChange(rgbCount[2], 2)
rbg = toChange(rgbCount[0], 0) + toChange(rgbCount[1], 2) + toChange(rgbCount[2], 1)
gbr = toChange(rgbCount[0], 1) + toChange(rgbCount[1], 2) + toChange(rgbCount[2], 0)
grb = toChange(rgbCount[0], 1) + toChange(rgbCount[1], 0) + toChange(rgbCount[2], 2)
bgr = toChange(rgbCount[0], 2) + toChange(rgbCount[1], 1) + toChange(rgbCount[2], 0)
brg = toChange(rgbCount[0], 2) + toChange(rgbCount[1], 0) + toChange(rgbCount[2], 1)
print(min(rgb, rbg, gbr, grb, bgr, brg))
if rgb == min(rgb, rbg, gbr, grb, bgr, brg):
	print(colourMaker('RGB', s, n))
elif rbg == min(rgb, rbg, gbr, grb, bgr, brg):
	print(colourMaker('RBG', s, n))
elif gbr == min(rgb, rbg, gbr, grb, bgr, brg):
	print(colourMaker('GBR', s, n))
elif grb == min(rgb, rbg, gbr, grb, bgr, brg):
	print(colourMaker('GRB', s, n))
elif bgr == min(rgb, rbg, gbr, grb, bgr, brg):
	print(colourMaker('BGR', s, n))
elif brg == min(rgb, rbg, gbr, grb, bgr, brg):
	print(colourMaker('BRG', s, n))


n = int(input())
s = list(input()) + ['*']
a = ['*']
l = list('GRB')
c = 0
for i in range(n):
	if s[i] == a[-1]:
		for j in l:
			if j != a[-1] and j != s[i + 1]:
				a.append(j)
				c += 1
				break
	else:
		a.append(s[i])
print(c)
print(''.join(a[1:]))


import sys
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
n = inp()
s = list(input())
d = {'R': 0, 'G': 1, 'B': 2}
s = [d[x] for x in s]
res = INF
dp = [[0] * 3 for _ in range(n)]
root = [[0] * (n - 1) for _ in range(3)]
for i in range(3):
	tmp = 0 if s[0] == i else 1
	dp[0][i] = tmp
for i in range(1, n):
	for j in range(3):
		tmp = 0 if s[i] == j else 1
		ans = INF
		pre = -1
		for k in range(3):
			if j == k:
				continue
			if dp[i - 1][k] + tmp < ans:
				ans = dp[i - 1][k] + tmp
				pre = k
		dp[i][j] = ans
		root[j][i - 1] = pre
res = INF
ind = -1
for i in range(3):
	if dp[-1][i] < res:
		res = dp[-1][i]
		ind = i
print(res)
res = [ind]
for i in range(n - 1)[::-1]:
	res.append(root[res[-1]][i])
d = {0: 'R', 1: 'G', 2: 'B'}
res = [d[x] for x in res[::-1]]
print(''.join(res))


from itertools import *
n = int(input())
garland = input()
allGarlands = dict(zip(tuple(permutations('RGB', 3)), [0] * 6))
for i in range(n):
	for current in allGarlands:
		if current[i % 3] != garland[i]:
			allGarlands[current] += 1
minGarland = min(allGarlands, key=allGarlands.get)
print(allGarlands[minGarland])
print(''.join(minGarland * (n // 3)) + ''.join(minGarland)[:n % 3])


n = int(input())
x = input()
r = [0, 0, 0]
g = [0, 0, 0]
b = [0, 0, 0]
ans = [n // 3] * 3
if n % 3 >= 1:
	ans[0] += 1
if n % 3 == 2:
	ans[1] += 1
for i in range(len(x)):
	if x[i] == 'R':
		r[i % 3] += 1
	if x[i] == 'B':
		b[i % 3] += 1
	if x[i] == 'G':
		g[i % 3] += 1
l = 'RGB' * (n // 3)
if n % 3 >= 1:
	l += 'R'
if n % 3 == 2:
	l += 'G'
min = ans[0] - r[0] + ans[1] - g[1] + ans[2] - b[2]
c = ans[0] - r[0] + ans[1] - b[1] + ans[2] - g[2]
if c < min:
	l = 'RBG' * (n // 3)
	if n % 3 >= 1:
		l += 'R'
	if n % 3 == 2:
		l += 'B'
	min = c
c = ans[0] - b[0] + ans[1] - g[1] + ans[2] - r[2]
if c < min:
	l = 'BGR' * (n // 3)
	if n % 3 >= 1:
		l += 'B'
	if n % 3 == 2:
		l += 'G'
	min = c
c = ans[0] - b[0] + ans[1] - r[1] + ans[2] - g[2]
if c < min:
	l = 'BRG' * (n // 3)
	if n % 3 >= 1:
		l += 'B'
	if n % 3 == 2:
		l += 'R'
	min = c
c = ans[0] - g[0] + ans[1] - b[1] + ans[2] - r[2]
if c < min:
	l = 'GBR' * (n // 3)
	if n % 3 >= 1:
		l += 'G'
	if n % 3 == 2:
		l += 'B'
	min = c
c = ans[0] - g[0] + ans[1] - r[1] + ans[2] - b[2]
if c < min:
	l = 'GRB' * (n // 3)
	if n % 3 >= 1:
		l += 'G'
	if n % 3 == 2:
		l += 'R'
	min = c
print(min)
print(l)


n = int(input())
s = list(input()) + [' '] + [' ']
counter = 0
for i in range(n):
	if s[i] == s[i + 1]:
		if s[i] != 'R' and s[i + 2] != 'R':
			s[i + 1] = 'R'
		elif s[i] != 'G' and s[i + 2] != 'G':
			s[i + 1] = 'G'
		else:
			s[i + 1] = 'B'
		counter += 1
print(counter)
tot = ''
for item in s:
	tot += item
print(tot[:-2])


n = int(input())
s = input()
c = 0
mi = 0
if n == 2:
	if s not in ['RG', 'GR', 'RB', 'BR', 'GB', 'BG']:
		if s[0] == 'R':
			ans = 'RG'
		else:
			ans = s[0] + 'R'
		c += 1
	mi = c
else:
	mi = float('inf')
	li = ['RGB', 'RBG', 'GBR', 'GRB', 'BRG', 'BGR']
	for t in li:
		c = 0
		for i in range(n):
			if s[i] != t[i % 3]:
				c += 1
		if c < mi:
			mi = c
			ans = t
	ans = ans * (n // 3) + ans[0:n % 3]
print(mi)
print(ans)


from sys import stdin, stdout
n = int(stdin.readline())
string = stdin.readline()
chars = list(string)
subs = [[1, 0, 0], [2, 2, 1]]
dic = {0: 'R', 1: 'G', 2: 'B'}
rdic = {'R': 0, 'G': 1, 'B': 2}
ct = 0
for i in range(1, n - 1):
	if chars[i] == chars[i - 1]:
		ct += 1
		ch = rdic[chars[i]]
		if chars[i + 1] == dic[subs[0][ch]]:
			chars[i] = dic[subs[1][ch]]
		else:
			chars[i] = dic[subs[0][ch]]
if n > 1:
	if chars[n - 2] == chars[n - 1]:
		ct += 1
		ch = rdic[chars[n - 1]]
		chars[n - 1] = dic[subs[0][ch]]
stdout.write(str(ct) + '\n')
stdout.write(''.join(chars[:]) + '\n')


n = int(input())
s = input()
X = [[0] * n for i in range(3)]
Y = [[0] * n for i in range(3)]
if s[0] == 'R':
	X[1][0] = 1
	X[2][0] = 1
elif s[0] == 'G':
	X[0][0] = 1
	X[2][0] = 1
else:
	X[0][0] = 1
	X[1][0] = 1
for i in range(1, n):
	if X[1][i - 1] <= X[2][i - 1]:
		X[0][i] = X[1][i - 1] + 1 * (s[i] != 'R')
		Y[0][i] = 1
	else:
		X[0][i] = X[2][i - 1] + 1 * (s[i] != 'R')
		Y[0][i] = 2
	if X[0][i - 1] <= X[2][i - 1]:
		X[1][i] = X[0][i - 1] + 1 * (s[i] != 'G')
		Y[1][i] = 0
	else:
		X[1][i] = X[2][i - 1] + 1 * (s[i] != 'G')
		Y[1][i] = 2
	if X[0][i - 1] <= X[1][i - 1]:
		X[2][i] = X[0][i - 1] + 1 * (s[i] != 'B')
		Y[2][i] = 0
	else:
		X[2][i] = X[1][i - 1] + 1 * (s[i] != 'B')
		Y[2][i] = 1
T = [''] * n
a = 0
if X[0][n - 1] <= X[1][n - 1] and X[0][n - 1] <= X[2][n - 1]:
	a = 0
elif X[1][n - 1] <= X[2][n - 1]:
	a = 1
else:
	a = 2
print(X[a][n - 1])
for i in range(n)[::-1]:
	T[i] = 'RGB'[a]
	if i > 0:
		a = Y[a][i]
for t in T:
	print(t, end='')
print('')


import sys
input = sys.stdin.readline
opts = 'RGB'
n = int(input().strip())
s = list(input().strip())
if n == 1:
	print(0)
	exit(print(''.join(s)))
c = 0
for i in range(1, n - 1):
	if s[i] == s[i - 1]:
		c += 1
		for op in opts:
			if op != s[i] and op != s[i + 1]:
				s[i] = op
				break
if s[-1] == s[-2]:
	s[-1] = opts[(opts.index(s[-1]) + 1) % 3]
	c += 1
print(c)
print(''.join(s))


def main():
	length = int(input())
	string = input()
	myList = ['RGB', 'BRG', 'RBG', 'BGR', 'GRB', 'GBR']
	newStrings = [x * int(length / 3 + 2) for x in myList]
	minChanges = 200000.0 + 1
	whichStr = ''
	for strings in newStrings:
		i = 0
		changes = 0
		for i in range(length):
			if strings[i] != string[i]:
				i += 1
				changes += 1
		if changes < minChanges:
			minChanges = changes
			whichStr = strings[0:length]
	print(minChanges)
	print(whichStr)
main()


n = int(input())
l = list(input())
a = {'R': 0, 'G': 1, 'B': 2}
b = ['R', 'G', 'B']
c = 0
for i in range(n - 1):
	if l[i] == l[i + 1]:
		c += 1
		if i + 2 < n and l[i] == l[i + 2]:
			l[i + 1] = b[a[l[i]] - 1]
		elif i + 2 < n and l[i] != l[i + 2]:
			l[i + 1] = b[3 - a[l[i]] - a[l[i + 2]]]
		else:
			l[i + 1] = b[a[l[i]] - 1]
print(c)
print(''.join(l))


n = int(input())
s = str(input())
red = []
green = []
blue = []
girl = []
for i in range(3):
	red.append(0)
	green.append(0)
	blue.append(0)
	girl.append('')
for mod in range(0, 3):
	r = 0
	g = 0
	b = 0
	for i in range(mod, n, 3):
		if s[i] == 'R':
			r += 1
		if s[i] == 'B':
			b += 1
		if s[i] == 'G':
			g += 1
	green[mod] = r + b
	blue[mod] = r + g
	red[mod] = g + b
minimum = n
for i in range(3):
	counter = 0
	for j in range(3):
		for z in range(3):
			if i != j and j != z and (i != z):
				counter = red[i] + green[j] + blue[z]
				if counter < minimum:
					minimum = counter
					girl[i] = 'R'
					girl[j] = 'G'
					girl[z] = 'B'
string = girl[0] + girl[1] + girl[2]
count = n // 3
str = string * count
str += string[:n % 3]
print(minimum)
print(str)


import itertools
import copy
n = int(input())
TmpArr = list(input().strip())
seq = TmpArr[:3]
if len(seq) == 1:
	print(0)
	print(''.join(TmpArr))
elif len(seq) == 2:
	if TmpArr[1] == TmpArr[0]:
		print(1)
		if TmpArr[1] == 'G':
			TmpArr[0] = 'R'
		elif TmpArr[1] == 'B':
			TmpArr[0] = 'R'
		else:
			TmpArr[0] = 'B'
	else:
		print(0)
	print(''.join(TmpArr))
else:
	k = 0
	P = []
	x = ['R', 'G', 'B']
	for i in itertools.permutations(x):
		P.append(i)
	tmpK = n + 1
	ans = copy.deepcopy(TmpArr)
	for pi in P:
		k = 0
		seq = pi
		arr = copy.deepcopy(TmpArr)
		for i in range(n):
			if i % 3 == 0:
				if arr[i] != seq[0]:
					k += 1
					arr[i] = seq[0]
			elif (i - 1) % 3 == 0:
				if arr[i] != seq[1]:
					k += 1
					arr[i] = seq[1]
			elif (i - 2) % 3 == 0:
				if arr[i] != seq[2]:
					k += 1
					arr[i] = seq[2]
		if k < tmpK:
			ans = copy.deepcopy(arr)
			tmpK = k
	print(tmpK)
	print(''.join(ans))


q = int(input())
Grlnda = list(input())
ex1 = ['R', 'G', 'B']
c1 = 0
line1 = ''
ex2 = ['G', 'R', 'B']
c2 = 0
line2 = ''
ex3 = ['G', 'B', 'R']
c3 = 0
line3 = ''
ex4 = ['R', 'B', 'G']
c4 = 0
line4 = ''
ex5 = ['B', 'G', 'R']
c5 = 0
line5 = ''
ex6 = ['B', 'R', 'G']
c6 = 0
line6 = ''
for i in range(q):
	line1 = line1 + ex1[i % 3]
	line2 = line2 + ex2[i % 3]
	line3 = line3 + ex3[i % 3]
	line4 = line4 + ex4[i % 3]
	line5 = line5 + ex5[i % 3]
	line6 = line6 + ex6[i % 3]
	if Grlnda[i] != ex1[i % 3]:
		c1 = c1 + 1
	if Grlnda[i] != ex2[i % 3]:
		c2 = c2 + 1
	if Grlnda[i] != ex3[i % 3]:
		c3 = c3 + 1
	if Grlnda[i] != ex4[i % 3]:
		c4 = c4 + 1
	if Grlnda[i] != ex5[i % 3]:
		c5 = c5 + 1
	if Grlnda[i] != ex6[i % 3]:
		c6 = c6 + 1
numlist = [c1, c2, c3, c4, c5, c6]
strlist = [line1, line2, line3, line4, line5, line6]
print(min(numlist))
print(strlist[numlist.index(min(numlist))])


input()
s = input()
orders = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
garlands = [''.join((o[i % 3] for i in range(len(s)))) for o in orders]
with_changes = [(g, sum((int(c1 != c2) for (c1, c2) in zip(g, s)))) for g in garlands]
(g, c) = min(with_changes, key=lambda t: t[1])
print(c)
print(g)


n = int(input())
s = [tmp for tmp in input().strip()] + ['R']
dfc = {'R': 1, 'G': 2, 'B': 4}
dtc = {2: 'G', 3: 'B', 4: 'B', 5: 'G', 6: 'R', 8: 'R'}
r = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		r += 1
		s[i] = dtc[dfc[s[i - 1]] + dfc[s[i + 1]]]
print(r)
print(*s[:-1], sep='')


n = int(input())
ad = input()
l = 'RGB'
ct = 0
a = list(ad)
if len(a) == 1:
	print(0)
	print(ad)
elif len(a) == 2:
	if a[0] == a[1]:
		print(1)
	for k in l:
		if k != a[0]:
			break
	a[0] = k
	print(''.join(a))
else:
	for i in range(len(a) - 2):
		if a[i] == a[i + 1]:
			for k in l:
				if k != a[i] and k != a[i + 2]:
					break
			a[i + 1] = k
			ct += 1
	if a[-1] == a[-2]:
		for k in l:
			if k != a[-2]:
				break
		a[-1] = k
		ct += 1
	print(ct)
	print(''.join(a))


n = int(input())
s = list(input())
cur = 'X'
(start, end) = (0, 0)
i = 0
ans = 0
while i < n:
	if s[i] != cur:
		cur = s[i]
		start = i
		while i < n and s[i] == cur:
			i += 1
		if i == n:
			for ch in 'RBG':
				if ch != s[start]:
					use = ch
					break
		else:
			for ch in 'RBG':
				if ch != s[start] and ch != s[i]:
					use = ch
					break
		end = i - 1
		for j in range(start, end + 1):
			if (j - start) % 2:
				s[j] = use
				ans += 1
print(ans)
print(''.join(s))


input()
garland = input()
beautiful_garland_codes = ['RGB', 'RBG', 'GBR', 'GRB', 'BGR', 'BRG']
variables_dict = dict()
for bg_code in beautiful_garland_codes:
	before_feature_garland = bg_code * (len(garland) // 3 + 1)
	feature_garland = before_feature_garland[:len(garland)]
	color_changes = 0
	for ind in range(len(feature_garland)):
		if feature_garland[ind] != garland[ind]:
			color_changes += 1
	variables_dict[color_changes] = feature_garland
best_choice = min(variables_dict)
print(best_choice)
print(variables_dict[best_choice])


n = int(input())
t = input()
st = list(t)
ans_c = 0
for i in range(len(t)):
	if i == len(t) - 1:
		break
	else:
		pass
	if st[i] == st[i + 1]:
		ans_c += 1
		RGB = ['R', 'G', 'B']
		RGB.remove(st[i])
		try:
			RGB.remove(st[i + 2])
		except:
			pass
		st[i + 1] = RGB[0]
	else:
		pass
ans = ''.join(st)
print(ans_c)
print(ans)


import itertools
n = int(input())
s = list(input())
count = 0
values = {(l, r): next(iter(set('RGB') - {l, r})) for (l, r) in itertools.product('RGB', repeat=2)}
ranges = []
start = None
for i in range(1, n):
	if s[i - 1] == s[i]:
		if start is None:
			start = i - 1
	elif start is not None:
		ranges.append((start, i))
		start = None
if start is not None:
	ranges.append((start, n))
for r in ranges:
	for i in range(r[0] + 1, r[1], 2):
		l = s[i - 1]
		r = s[(i + 1) % n]
		s[i] = values[l, r]
		count += 1
print(count)
print(''.join(s))


from functools import reduce
n = int(input())
letters = ['R', 'G', 'B']
string = list(input())
priority = [[(n - j - 1) // 3 + 1 for i in range(0, 3)] for j in range(0, 3)]
turns = 0
for d in range(0, 3):
	i = d
	while i < n:
		if string[i] == 'R':
			priority[d][0] -= 1
		if string[i] == 'G':
			priority[d][1] -= 1
		if string[i] == 'B':
			priority[d][2] -= 1
		i += 3
maps = ((0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0))
opti = min(maps, key=lambda m: sum([priority[i][m[i]] for i in range(0, 3)]))
for d in range(0, 3):
	i = d
	while i < n:
		string[i] = letters[opti[d]]
		i += 3
	turns += priority[d][opti[d]]
print(turns)
print(''.join(string))


number = int(input())
data = input()
result = [data[0]]
k = 0
Set = {'B', 'G', 'R'}
for i in range(1, number):
	if result[-1] != data[i]:
		result.append(data[i])
	else:
		k += 1
		if i != number - 1:
			a = data[i + 1]
			b = data[i]
			P = list(Set - {a, b})[0]
			result.append(P)
		else:
			b = data[i]
			P = list(Set - set([b]))[0]
			result.append(P)
print(k)
print(''.join(result))


import sys
import math

def main():
	n = int(sys.stdin.readline().strip())
	s = sys.stdin.readline().strip()
	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)
main()


n = int(input())
s = input()
a = ['R G B', 'R B G', 'G R B', 'G B R', 'B G R', 'B R G']
min = 9999999
minidx = 999999
for i in range(0, 6, 1):
	c = 0
	x = a[i].split()
	q = 0
	for j in s:
		if j != x[q]:
			c = c + 1
		q = (q + 1) % 3
	if min > c:
		min = c
		minidx = i
print(min)
d = a[minidx].split()
t = 0
for i in range(0, n, 1):
	print(d[t], end='')
	t = (t + 1) % 3


import math
from itertools import permutations, cycle
n = int(input())
arr = list(input())
combs = [''.join(p) for p in permutations('RGB', 3)]
diffs = [0] * len(combs)
for i in range(n):
	for j in range(len(combs)):
		if combs[j][i % 3] != arr[i]:
			diffs[j] += 1
best_res = min(diffs)
best_comb = combs[diffs.index(best_res)]
res = best_comb * (n // 3) + best_comb[:n % 3]
print(best_res)
print(res)


import sys
input = sys.stdin.readline
n = int(input())
a = list(input())
a.pop()
res = n
if n == 1:
	print(0)
	print(''.join(a))
elif n == 2:
	if len(set(a)) == 1:
		print(1)
		if a[0] == 'G':
			print(a[0] + 'R')
		else:
			print(a[0] + 'G')
	else:
		print(0)
		print(''.join(a))
else:
	m = n // 3 + 1
	kouho = ['RGB' * m, 'RBG' * m, 'BGR' * m, 'BRG' * m, 'GBR' * m, 'GRB' * m]
	mi = n + 1
	idx = -1
	for i in range(6):
		tmp = 0
		for j in range(n):
			if kouho[i][j] != a[j]:
				tmp += 1
		if tmp < mi:
			mi = tmp
			idx = i
	print(mi)
	print(kouho[idx][:n])


n = int(input())
s = input()
d1 = {'R': 0, 'G': 0, 'B': 0}
d2 = {'R': 0, 'G': 0, 'B': 0}
d0 = {'R': 0, 'G': 0, 'B': 0}
for (ind, let) in enumerate(s):
	if ind % 3 == 1:
		d1[let] += 1
	elif ind % 3 == 2:
		d2[let] += 1
	else:
		d0[let] += 1
rgb = d0['G'] + d0['B'] + d1['R'] + d1['B'] + d2['R'] + d2['G']
rbg = d0['G'] + d0['B'] + d1['R'] + d1['G'] + d2['R'] + d2['B']
gbr = d0['R'] + d0['B'] + d1['R'] + d1['G'] + d2['B'] + d2['G']
grb = d0['R'] + d0['B'] + d1['B'] + d1['G'] + d2['R'] + d2['G']
brg = d0['G'] + d0['R'] + d1['G'] + d1['B'] + d2['R'] + d2['B']
bgr = d0['G'] + d0['R'] + d1['R'] + d1['B'] + d2['G'] + d2['B']
minn = min(rgb, rbg, gbr, grb, brg, bgr)
ss = ''
num = 0
if rgb == minn:
	num = rgb
	for i in range(n):
		if i % 3 == 0:
			ss += 'R'
		elif i % 3 == 1:
			ss += 'G'
		else:
			ss += 'B'
elif rbg == minn:
	num = rbg
	for i in range(n):
		if i % 3 == 0:
			ss += 'R'
		elif i % 3 == 1:
			ss += 'B'
		else:
			ss += 'G'
elif bgr == minn:
	num = bgr
	for i in range(n):
		if i % 3 == 0:
			ss += 'B'
		elif i % 3 == 1:
			ss += 'G'
		else:
			ss += 'R'
elif brg == minn:
	num = brg
	for i in range(n):
		if i % 3 == 0:
			ss += 'B'
		elif i % 3 == 1:
			ss += 'R'
		else:
			ss += 'G'
elif grb == minn:
	num = grb
	for i in range(n):
		if i % 3 == 0:
			ss += 'G'
		elif i % 3 == 1:
			ss += 'R'
		else:
			ss += 'B'
elif gbr == minn:
	num = gbr
	for i in range(n):
		if i % 3 == 0:
			ss += 'G'
		elif i % 3 == 1:
			ss += 'B'
		else:
			ss += 'R'
print(num)
print(ss)


from itertools import permutations
n = int(input())
s = input()
ans = n
sans = 'kek'
z1 = s[0::3]
z2 = s[1::3]
z3 = s[2::3]
for i in permutations(['R', 'G', 'B']):
	kol = 0
	kol += len(list(filter(lambda c: c != i[0], z1)))
	kol += len(list(filter(lambda c: c != i[1], z2)))
	kol += len(list(filter(lambda c: c != i[2], z3)))
	if kol < ans:
		ans = kol
		sans = ''.join(i) * len(z3)
		sans = sans + i[0] * (len(z1) - len(z3))
		sans = sans + i[1] * (len(z2) - len(z3))
print(ans)
print(sans)


n = int(input())
s = list(str(input()))
changesMade = 0
i = 0
while i < n - 1:
	if s[i] == s[i + 1]:
		j = i + 0
		while j < n - 1 and s[j] == s[j + 1]:
			if (j - i) % 2 == 0:
				k = j + 1
				if k >= n - 2:
					if s[k - 1] != 'B':
						s[k] = 'B'
					else:
						s[k] = 'G'
				elif s[k - 1] != 'G' and s[k + 1] != 'G':
					s[k] = 'G'
				elif s[k - 1] != 'B' and s[k + 1] != 'B':
					s[k] = 'B'
				elif s[k - 1] != 'R' and s[k + 1] != 'R':
					s[k] = 'R'
				else:
					print('ERROR')
				changesMade += 1
			j += 1
	i += 1
print(changesMade)
print(''.join(s))


def s(s1, s2):
	p = 0
	for j in range(len(s1)):
		if s1[j] != s2[j]:
			p += 1
	return p
n = int(input())
b = input()
p = n // 3
r = n % 3
A = ['RGB'] * p
if r == 0:
	a = ''.join(A)
elif r == 1:
	a = ''.join(A)
	a += 'R'
elif r == 2:
	a = ''.join(A)
	a += 'RG'
a1 = s(b, a)
C = ['RBG'] * p
if r == 0:
	c = ''.join(C)
elif r == 1:
	c = ''.join(C)
	c += 'R'
elif r == 2:
	c = ''.join(C)
	c += 'RB'
c1 = s(b, c)
D = ['BRG'] * p
if r == 0:
	d = ''.join(D)
elif r == 1:
	d = ''.join(D)
	d += 'B'
elif r == 2:
	d = ''.join(D)
	d += 'BR'
d1 = s(b, d)
E = ['BGR'] * p
if r == 0:
	e = ''.join(E)
elif r == 1:
	e = ''.join(E)
	e += 'B'
elif r == 2:
	e = ''.join(E)
	e += 'BG'
e1 = s(b, e)
F = ['GBR'] * p
if r == 0:
	f = ''.join(F)
elif r == 1:
	f = ''.join(F)
	f += 'G'
elif r == 2:
	f = ''.join(F)
	f += 'GB'
f1 = s(b, f)
G = ['GRB'] * p
if r == 0:
	g = ''.join(G)
elif r == 1:
	g = ''.join(G)
	g += 'G'
elif r == 2:
	g = ''.join(G)
	g += 'GR'
g1 = s(b, g)
q = min(a1, c1, d1, e1, f1, g1)
print(q)
if a1 == q:
	print(a)
elif c1 == q:
	print(c)
elif d1 == q:
	print(d)
elif e1 == q:
	print(e)
elif f1 == q:
	print(f)
elif g1 == q:
	print(g)


from collections import defaultdict
n = int(input())
a = list(input())
x = defaultdict(lambda : '')
x['RR'] = 'B'
x['GG'] = 'R'
x['BB'] = 'G'
x['BR'] = 'G'
x['RB'] = 'G'
x['GR'] = 'B'
x['RG'] = 'B'
x['BG'] = 'R'
x['GB'] = 'R'
x['G'] = 'R'
x['B'] = 'R'
x['R'] = 'B'
ans = 0
for i in range(n - 2):
	if a[i] == a[i + 1]:
		ans += 1
		a[i + 1] = x[a[i] + a[i + 2]]
if n > 1 and a[n - 2] == a[n - 1]:
	ans += 1
	a[n - 1] = x[a[n - 2]]
print(ans)
print(*a, sep='')


from itertools import permutations
n = int(input())
s = input()
a = list(permutations('RGB'))
cnt = [0 for i in range(6)]
for i in range(n):
	for j in range(6):
		if s[i] != a[j][i % 3]:
			cnt[j] += 1
ans = min(cnt)
ind = cnt.index(ans)
print(ans)
aa = ''
for i in range(min(n, 3)):
	aa += a[ind][i % 3]
print(aa, end='')
for i in range(3, n):
	print(aa[i % 3], end='')


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
try:
	import numpy

	def dprint(*args, **kwargs):
		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())
(N,) = getIntList()
s = input()
zs = list(s)
g = 'RGB'
r = 0
for i in range(1, N):
	if zs[i] == zs[i - 1]:
		r += 1
		for x in g:
			if x == zs[i - 1]:
				continue
			if i < N - 1 and x == zs[i + 1]:
				continue
			zs[i] = x
			break
print(r)
print(''.join(zs))


from itertools import permutations, cycle

def gen_variation(permutation, g_len):
	variation = []
	count = 0
	for color in cycle(permutation):
		if count == g_len:
			return variation
		variation.append(color)
		count += 1

def gen_beauty(g_len):
	colors_permutations = list(permutations(['R', 'G', 'B']))
	variations = []
	for permutation in colors_permutations:
		variations.append(gen_variation(permutation, g_len))
	return variations

def compare_garlands(garland, beauty_garlands):
	min_diff = len(garland)
	for beauty_garland in beauty_garlands:
		count = 0
		compare_garlands = list(zip(garland, beauty_garland))
		for pair in compare_garlands:
			if pair[0] != pair[1]:
				count += 1
		if count < min_diff:
			min_diff = count
			result_garland = beauty_garland
	print(min_diff)
	print(''.join(result_garland))
n = int(input())
garland = list(str(input()))
compare_garlands(garland, gen_beauty(n))


c = 0
n = int(input())
s = list(input())
posible = ['B', 'G', 'R']
if n != 1:
	for i in range(1, n - 1):
		if s[i] == s[i - 1]:
			if s[i] == 'R' and s[i + 1] != 'B':
				s[i] = 'B'
			elif s[i] == 'R' and s[i + 1] != 'G':
				s[i] = 'G'
			elif s[i] == 'G' and s[i + 1] != 'B':
				s[i] = 'B'
			elif s[i] == 'G' and s[i + 1] != 'R':
				s[i] = 'R'
			elif s[i] == 'B' and s[i + 1] != 'R':
				s[i] = 'R'
			elif s[i] == 'B' and s[i + 1] != 'G':
				s[i] = 'G'
			c += 1
	if s[-1] == s[-2]:
		c += 1
		for i in posible:
			if i != s[-1]:
				s[-1] = i
				break
else:
	c = 0
print(c)
print(''.join(s))


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)))


l = int(input())
a = input()
print(*min(((sum((a[j] != i[j] for j in range(l))), i) for i in ((v * (l // 3 + 1))[:l] for v in ('RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR')))), sep='\n')


(N, Lamps) = (int(input()), input())
MyDict = {'RGB': 0, 'RBG': 0, 'GBR': 0, 'GRB': 0, 'BRG': 0, 'BGR': 0}
for i in range(N):
	for key in MyDict:
		if key[i % 3] != Lamps[i]:
			MyDict[key] += 1
Key = list(MyDict.keys())[list(MyDict.values()).index(min(MyDict.values()))]
print(min(MyDict.values()), Key * (N // 3) + Key[:N % 3], sep='\n')


import sys
n = int(sys.stdin.readline())
s = str(sys.stdin.readline())
d = {'R': [], 'B': [], 'G': []}
for i in range(n):
	d[s[i]].append(i)
r0 = len(list(filter(lambda x: x % 3 == 0, d['R'])))
r1 = len(list(filter(lambda x: x % 3 == 1, d['R'])))
r2 = len(list(filter(lambda x: x % 3 == 2, d['R'])))
g0 = len(list(filter(lambda x: x % 3 == 0, d['G'])))
g1 = len(list(filter(lambda x: x % 3 == 1, d['G'])))
g2 = len(list(filter(lambda x: x % 3 == 2, d['G'])))
b0 = len(list(filter(lambda x: x % 3 == 0, d['B'])))
b1 = len(list(filter(lambda x: x % 3 == 1, d['B'])))
b2 = len(list(filter(lambda x: x % 3 == 2, d['B'])))
arr = [r1 + r2 + g0 + g2 + b0 + b1, r1 + r2 + g0 + g1 + b0 + b2, r0 + r2 + g1 + g2 + b0 + b1, r0 + r2 + g0 + g1 + b2 + b1, r1 + r0 + g0 + g2 + b2 + b1, r1 + r0 + g1 + g2 + b0 + b2]
m = min(arr)
print(m)
if m == arr[0]:
	for i in range(n - 1):
		if i % 3 == 0:
			print('R', end='')
		elif i % 3 == 1:
			print('G', end='')
		else:
			print('B', end='')
	if (n - 1) % 3 == 0:
		print('R')
	elif (n - 1) % 3 == 1:
		print('G')
	else:
		print('B')
elif m == arr[1]:
	for i in range(n - 1):
		if i % 3 == 0:
			print('R', end='')
		elif i % 3 == 1:
			print('B', end='')
		else:
			print('G', end='')
	if (n - 1) % 3 == 0:
		print('R')
	elif (n - 1) % 3 == 1:
		print('B')
	else:
		print('G')
elif m == arr[2]:
	for i in range(n - 1):
		if i % 3 == 0:
			print('G', end='')
		elif i % 3 == 1:
			print('R', end='')
		else:
			print('B', end='')
	if (n - 1) % 3 == 0:
		print('G')
	elif (n - 1) % 3 == 1:
		print('R')
	else:
		print('B')
elif m == arr[3]:
	for i in range(n - 1):
		if i % 3 == 0:
			print('B', end='')
		elif i % 3 == 1:
			print('R', end='')
		else:
			print('G', end='')
	if (n - 1) % 3 == 0:
		print('B')
	elif (n - 1) % 3 == 1:
		print('R')
	else:
		print('G')
elif m == arr[4]:
	for i in range(n - 1):
		if i % 3 == 0:
			print('B', end='')
		elif i % 3 == 1:
			print('G', end='')
		else:
			print('R', end='')
	if (n - 1) % 3 == 0:
		print('B')
	elif (n - 1) % 3 == 1:
		print('G')
	else:
		print('R')
else:
	for i in range(n - 1):
		if i % 3 == 0:
			print('G', end='')
		elif i % 3 == 1:
			print('B', end='')
		else:
			print('R', end='')
	if (n - 1) % 3 == 0:
		print('G')
	elif (n - 1) % 3 == 1:
		print('B')
	else:
		print('R')


input()
s = list(input())
c = 0
for i in range(1, len(s)):
	t = list('RGB')
	if s[i - 1] == s[i]:
		t.remove(s[i - 1])
		if i < len(s) - 1 and s[i + 1] in t:
			t.remove(s[i + 1])
		s[i] = t[0]
		c += 1
print(c)
print(''.join(s))


from itertools import permutations
n = int(input())
s = input()
l = ['G', 'B', 'R']
perm = list(permutations(l))
z = float('inf')
for i in range(len(perm)):
	t = ''.join(perm[i])
	c = 0
	for j in range(0, n, 3):
		if t[0] != s[j]:
			c = c + 1
		if j + 1 < n and t[1] != s[j + 1]:
			c = c + 1
		if j + 2 < n and t[2] != s[j + 2]:
			c = c + 1
	z = min(z, c)
	if z == c:
		p = i
print(z)
print(''.join(perm[p] * int(n // 3) + perm[p][:n % 3]))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import Counter
import heapq
from collections import Counter
n = int(input())
s = list(input())
s += '.'
ans = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		ans += 1
		for ch in 'RGB':
			if s[i - 1] != ch and s[i + 1] != ch:
				s[i] = ch
				break
print(ans)
print(''.join(s)[:n])


n = int(input())
s = input()
arr = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
k = int((n + 2) / 3)
ans = int(100000000000.0)
anss = ''
for el in arr:
	st = el * k
	num = 0
	for i in range(n):
		if st[i] != s[i]:
			num += 1
	if num < ans:
		ans = num
		anss = st[:n]
print('{}\n{}'.format(ans, anss))


n = int(input())
s = input()
if n > 1:
	a = 'RGB' * (n // 3)
	a += 'RGB'[:n % 3]
	b = 'RBG' * (n // 3)
	b += 'RBG'[:n % 3]
	c = 'GBR' * (n // 3)
	c += 'GBR'[:n % 3]
	d = 'GRB' * (n // 3)
	d += 'GRB'[:n % 3]
	e = 'BRG' * (n // 3)
	e += 'BRG'[:n % 3]
	f = 'BGR' * (n // 3)
	f += 'BGR'[:n % 3]
	x = [a, b, c, d, e, f]
	c = n + 1
	for st in x:
		cnt = 0
		for i in range(n):
			if st[i] != s[i]:
				cnt += 1
		if cnt < c:
			c = cnt
			ans = st
	print(c)
	print(ans)
else:
	print(0)
	print(s)


n = int(input())
s = list(input())
l = ['R', 'G', 'B']
cnt = 0
j = 0
ans = s[0]
if n == 1:
	print(cnt)
	print(ans)
	exit(0)
for i in range(1, n - 1):
	if s[i - 1] == s[i]:
		cnt += 1
		while s[i] == s[i - 1] or s[i] == s[i + 1]:
			j += 1
			s[i] = l[j % 3]
	ans += s[i]
if s[n - 2] == s[n - 1]:
	cnt += 1
	while s[n - 1] == s[n - 2]:
		j += 1
		s[n - 1] = l[j % 3]
ans += s[n - 1]
print(cnt)
print(ans)


from timeit import default_timer as timer
from datetime import timedelta

def solve(s):
	n = len(s)
	cs = ['R', 'G', 'B']
	res = ''
	res_dist = int(100000000.0)
	best = ''
	for c1 in cs:
		for c2 in cs:
			if c1 == c2:
				continue
			for c3 in cs:
				if c1 == c3 or c2 == c3:
					continue
				cur = ''
				cur_dst = 0
				for i in range(0, n):
					t = 'Q'
					if i % 3 == 0:
						t = c1
					if i % 3 == 1:
						t = c2
					if i % 3 == 2:
						t = c3
					if t != s[i]:
						cur_dst += 1
				if cur_dst < res_dist:
					res_dist = cur_dst
					res = cur
					best = c1 + c2 + c3
	for i in range(0, n):
		res += best[i % 3]
	return [res_dist, res]
n = int(input())
s = input()
start = timer()
ans = solve(s)
end = timer()
print(ans[0])
print(ans[1])


n = int(input())
s = input()
s = list(s)
arr = [s[0]]
count = 0
for i in range(1, n):
	if arr[i - 1] != s[i]:
		arr.append(s[i])
	else:
		count += 1
		if i < n - 1:
			if s[i] == 'G' and s[i + 1] == 'R':
				arr.append('B')
			elif s[i] == 'G' and s[i + 1] == 'B':
				arr.append('R')
			elif s[i] == 'G' and s[i + 1] == 'G':
				arr.append('B')
			elif s[i] == 'R' and s[i + 1] == 'G':
				arr.append('B')
			elif s[i] == 'R' and s[i + 1] == 'B':
				arr.append('G')
			elif s[i] == 'R' and s[i + 1] == 'R':
				arr.append('B')
			elif s[i] == 'B' and s[i + 1] == 'G':
				arr.append('R')
			elif s[i] == 'B' and s[i + 1] == 'R':
				arr.append('G')
			else:
				arr.append('G')
		elif s[i] == 'R' or s[i] == 'G':
			arr.append('B')
		else:
			arr.append('R')
print(count)
print(''.join(arr))


from collections import defaultdict
n = int(input())
s = [i for i in input()]
d = {'R': [0, 0, 0], 'G': [0, 0, 0], 'B': [0, 0, 0]}
for i in range(n):
	d[s[i]][i % 3] += 1
pattern = ['R', 'G', 'B']
mx = 0
for i in range(3):
	for j in range(3):
		for k in range(3):
			if i != j and j != k and (i != k):
				if d['R'][i] + d['G'][j] + d['B'][k] > mx:
					mx = d['R'][i] + d['G'][j] + d['B'][k]
					pattern[i] = 'R'
					pattern[j] = 'G'
					pattern[k] = 'B'
print(n - mx)
print(''.join(pattern) * (n // 3) + ''.join(pattern[:n % 3]))


amount = int(input())
garland = list(input())
ans = 0
if amount == 1:
	print(0)
	print(garland[0])
else:
	for i in range(1, amount - 1):
		if garland[i - 1] == garland[i]:
			ans += 1
			if garland[i - 1] != 'R' and garland[i + 1] != 'R':
				garland[i] = 'R'
			elif garland[i - 1] != 'G' and garland[i + 1] != 'G':
				garland[i] = 'G'
			else:
				garland[i] = 'B'
	if garland[-1] == garland[-2]:
		ans += 1
		if garland[-2] != 'R':
			garland[-1] = 'R'
		else:
			garland[-1] = 'B'
	print(ans)
	for elem in garland:
		print(elem, end='')


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
import itertools
options = [''.join(i) for i in list(itertools.permutations(['R', 'G', 'B']))]
lens = read_int()
ins = input()
mins = int(100000000000.0)
ansl = mins
ans = ''
for i in options:
	curr = i * (lens // 3) + i[:lens % 3]
	curr_min = sum((1 for (x, y) in zip(ins, curr) if x != y))
	if curr_min < mins:
		ansl = curr_min
		ans = curr
		mins = curr_min
print(ansl)
print(ans)


n = int(input())
s = input()
l = []
for i in s:
	l.append(i)
i = 0

def color(a, b):
	if a == 'R' and b == 'B' or (a == 'B' and b == 'R'):
		return 'G'
	elif a == 'R' and b == 'G' or (a == 'G' and b == 'R'):
		return 'B'
	elif a == 'G' and b == 'B' or (a == 'B' and b == 'G'):
		return 'R'
	elif a == 'B':
		return 'R'
	elif a == 'R':
		return 'G'
	elif a == 'G':
		return 'B'
while i < n - 1:
	if i == n - 2:
		if l[i] == l[i + 1]:
			l[i + 1] = color(l[i], l[i - 1])
	elif l[i] == l[i + 1]:
		l[i + 1] = color(l[i], l[i + 2])
	i += 1
count = 0
st = ''
for j in l:
	st += str(j)
for j in range(n):
	if s[j] != st[j]:
		count += 1
print(count)
print(st)


n = int(input())
a = ['R', 'G', 'B']
listA = list(input())
count = 0
for i in range(n - 1):
	if listA[i] == listA[i + 1]:
		b = a[:]
		b.remove(listA[i + 1])
		if i + 2 < n:
			if listA[i + 2] in b:
				b.remove(listA[i + 2])
		listA[i + 1] = b[0]
		count += 1
print(count)
print(''.join(listA))


n = int(input())
s = str(input())
s1 = 'RGB'
s2 = 'RBG'
s3 = 'GBR'
s4 = 'GRB'
s5 = 'BGR'
s6 = 'BRG'
s11 = ''
s22 = ''
s33 = ''
s44 = ''
s55 = ''
s66 = ''
(a1, a2, a3, a4, a5, a6) = (0, 0, 0, 0, 0, 0)
for i in range(n // 3):
	s11 += s1
	s22 += s2
	s33 += s3
	s44 += s4
	s55 += s5
	s66 += s6
for i in range(n % 3):
	s11 += s1[i]
	s22 += s2[i]
	s33 += s3[i]
	s44 += s4[i]
	s55 += s5[i]
	s66 += s6[i]
for i in range(n):
	if s11[i] != s[i]:
		a1 += 1
	if s22[i] != s[i]:
		a2 += 1
	if s33[i] != s[i]:
		a3 += 1
	if s44[i] != s[i]:
		a4 += 1
	if s55[i] != s[i]:
		a5 += 1
	if s66[i] != s[i]:
		a6 += 1
print(min(a1, a2, a3, a4, a5, a6))
if min(a1, a2, a3, a4, a5, a6) == a1:
	print(s11)
elif min(a1, a2, a3, a4, a5, a6) == a2:
	print(s22)
elif min(a1, a2, a3, a4, a5, a6) == a3:
	print(s33)
elif min(a1, a2, a3, a4, a5, a6) == a4:
	print(s44)
elif min(a1, a2, a3, a4, a5, a6) == a5:
	print(s55)
elif min(a1, a2, a3, a4, a5, a6) == a6:
	print(s66)


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
try:
	import numpy

	def dprint(*args, **kwargs):
		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())
(N,) = getIntList()
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()
good = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
v = 0
minx = 1000000
for i in range(6):
	w = 0
	for j in range(n):
		if s[j] != good[i][j % 3]:
			w += 1
	if minx > w:
		minx = w
		v = i
print(minx)
for k in range(0, int(n / 3)):
	print(good[v], end='')
for x in range(0, n % 3):
	print(good[v][x], 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)


n = int(input())
s = [tmp for tmp in input().strip()]
r = 0
cs = {'R', 'G', 'B'}
for i in range(1, n - 1):
	if s[i] == s[i - 1]:
		r += 1
		s[i] = list(cs.difference({s[i - 1], s[i + 1]}))[0]
if n > 1 and s[n - 1] == s[n - 2]:
	r += 1
	s[n - 1] = list(cs.difference({s[n - 2]}))[0]
print(r)
print(*s, sep='')


n = int(input().strip())
s = input()
l = list(s)
n = len(s)
rem = n % 3
ans = [[], [], [], [], [], [], []]
ans[1] = 'RGB' * (n // 3) + 'RGB'[:rem]
ans[2] = 'GRB' * (n // 3) + 'GRB'[:rem]
ans[3] = 'GBR' * (n // 3) + 'GBR'[:rem]
ans[4] = 'RBG' * (n // 3) + 'RBG'[:rem]
ans[5] = 'BRG' * (n // 3) + 'BRG'[:rem]
ans[6] = 'BGR' * (n // 3) + 'BGR'[:rem]
c1 = c2 = c3 = c4 = c5 = c6 = 0
for i in range(n):
	if s[i] != ans[1][i]:
		c1 += 1
	if s[i] != ans[2][i]:
		c2 += 1
	if s[i] != ans[3][i]:
		c3 += 1
	if s[i] != ans[4][i]:
		c4 += 1
	if s[i] != ans[5][i]:
		c5 += 1
	if s[i] != ans[6][i]:
		c6 += 1
count = [c1, c2, c3, c4, c5, c6]
k = min(count)
count.insert(0, 0)
for i in range(1, 7):
	if k == count[i]:
		print(k)
		print(ans[i])
		break


total = int(input())
color = input()
mode = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
cnt = [0, 0, 0, 0, 0, 0]
_max = len(color)

def haveSame(a, b):
	result = 0
	assert type(a) is str
	assert type(b) is str
	for i in range(0, min(len(a), len(b))):
		if a[i] == b[i]:
			result += 1
	return result
for i in range(0, len(color), 3):
	for j in range(0, 6):
		cnt[j] += haveSame(mode[j], color[i:i + 3])
maxcnt = [cnt[0], 0]
for i in range(1, 6):
	if cnt[i] > maxcnt[0]:
		maxcnt = [cnt[i], i]
print(total - maxcnt[0])
if maxcnt[0] == 0:
	print(color)
else:
	print((mode[maxcnt[1]] * (total // 3 + 1))[:total])


n = int(input())
a = list(input())
c = [0] * 6
for i in range(n):
	if i % 3 == 0:
		if a[i] == 'R':
			c[0] += 1
			c[1] += 1
		if a[i] == 'B':
			c[2] += 1
			c[3] += 1
		if a[i] == 'G':
			c[4] += 1
			c[5] += 1
	if i % 3 == 1:
		if a[i] == 'R':
			c[2] += 1
			c[4] += 1
		if a[i] == 'B':
			c[1] += 1
			c[5] += 1
		if a[i] == 'G':
			c[0] += 1
			c[3] += 1
	if i % 3 == 2:
		if a[i] == 'R':
			c[3] += 1
			c[5] += 1
		if a[i] == 'B':
			c[0] += 1
			c[4] += 1
		if a[i] == 'G':
			c[1] += 1
			c[2] += 1
m = max(c)
x = c.index(m)
print(n - m)
if x == 0:
	for i in range(n):
		if i % 3 == 0:
			print('R', end='')
		elif i % 3 == 1:
			print('G', end='')
		elif i % 3 == 2:
			print('B', end='')
if x == 1:
	for i in range(n):
		if i % 3 == 0:
			print('R', end='')
		elif i % 3 == 1:
			print('B', end='')
		elif i % 3 == 2:
			print('G', end='')
if x == 2:
	for i in range(n):
		if i % 3 == 0:
			print('B', end='')
		elif i % 3 == 1:
			print('R', end='')
		elif i % 3 == 2:
			print('G', end='')
if x == 3:
	for i in range(n):
		if i % 3 == 0:
			print('B', end='')
		elif i % 3 == 1:
			print('G', end='')
		elif i % 3 == 2:
			print('R', end='')
if x == 4:
	for i in range(n):
		if i % 3 == 0:
			print('G', end='')
		elif i % 3 == 1:
			print('R', end='')
		elif i % 3 == 2:
			print('B', end='')
if x == 5:
	for i in range(n):
		if i % 3 == 0:
			print('G', end='')
		elif i % 3 == 1:
			print('B', end='')
		elif i % 3 == 2:
			print('R', end='')


aa = ['R', 'G', 'B']
n = int(input())
s = list(input()) + ['#']
c = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		j = 0
		while aa[j] == s[i - 1] or aa[j] == s[i + 1]:
			j += 1
		s[i] = aa[j]
		c += 1
print(c)
print(''.join(s[:-1]))


n = int(input())
s = input()
r = [0] * 3
g = [0] * 3
b = [0] * 3
for i in range(n):
	j = i % 3
	if s[i] == 'R':
		r[j] += 1
	elif s[i] == 'G':
		g[j] += 1
	else:
		b[j] += 1
rgb = n - r[0] - g[1] - b[2]
rbg = n - r[0] - b[1] - g[2]
grb = n - g[0] - r[1] - b[2]
gbr = n - g[0] - b[1] - r[2]
brg = n - b[0] - r[1] - g[2]
bgr = n - b[0] - g[1] - r[2]
m = min(rgb, rbg, gbr, grb, brg, bgr)
if rgb == m:
	ss = 'RGB'
elif rbg == m:
	ss = 'RBG'
elif gbr == m:
	ss = 'GBR'
elif grb == m:
	ss = 'GRB'
elif brg == m:
	ss = 'BRG'
else:
	ss = 'BGR'
print(m)
for i in range(n):
	print(ss[i % 3], end='')


def color(a, b):
	a_list = ['R', 'G', 'B']
	a_list.remove(a)
	if a != b:
		a_list.remove(b)
	return a_list[0]

def count(temp_list, temp):
	if temp == 'R':
		temp_list[0] = temp_list[0] + 1
	if temp == 'G':
		temp_list[1] = temp_list[1] + 1
	if temp == 'B':
		temp_list[2] = temp_list[2] + 1
	return temp_list
n = int(input())
s = input()
x = list(s)
colors = ['R', 'G', 'B']
first = [0, 0, 0]
second = [0, 0, 0]
third = [0, 0, 0]
a = 0
b = 0
c = 0
maximum = 0
if n == 1:
	print(0)
	print(s)
if n == 2:
	if x[0] == x[1]:
		x[0] = color(x[1], x[1])
		print(1)
		print(''.join(x))
if n > 2:
	for j in range(n):
		if j % 3 == 0:
			first = count(first, x[j])
		if j % 3 == 1:
			second = count(second, x[j])
		if j % 3 == 2:
			third = count(third, x[j])
	for j in range(3):
		for i in [x for x in range(3) if x != j]:
			for k in [x for x in range(3) if x != j and x != i]:
				if first[j] + second[i] + third[k] >= maximum:
					maximum = first[j] + second[i] + third[k]
					a = j
					b = i
					c = k
	for j in range(n):
		if j % 3 == 0:
			x[j] = colors[a]
		if j % 3 == 1:
			x[j] = colors[b]
		if j % 3 == 2:
			x[j] = colors[c]
	print(n - maximum)
	print(''.join(x))


n = int(input())
a = input()
s = list(a)
d = [0, 0, 0, 0, 0, 0]
ar = ['RGB', 'GRB', 'BGR', 'RBG', 'GBR', 'BRG']
i = 0
while i < n:
	if a[i] != 'R' and i < n:
		d[0] += 1
	if i + 1 < n and a[i + 1] != 'G':
		d[0] += 1
	if i + 2 < n and a[i + 2] != 'B':
		d[0] += 1
	i += 3
b = 0
while b < n:
	if a[b] != 'G':
		d[1] += 1
	if b + 1 < n and a[b + 1] != 'R':
		d[1] += 1
	if b + 2 < n and a[b + 2] != 'B':
		d[1] += 1
	b += 3
c = 0
while c < n:
	if a[c] != 'B':
		d[2] += 1
	if c + 1 < n and a[c + 1] != 'G':
		d[2] += 1
	if c + 2 < n and a[c + 2] != 'R':
		d[2] += 1
	c += 3
e = 0
while e < n:
	if a[e] != 'R':
		d[3] += 1
	if e + 1 < n and a[e + 1] != 'B':
		d[3] += 1
	if e + 2 < n and a[e + 2] != 'G':
		d[3] += 1
	e += 3
f = 0
while f < n:
	if a[f] != 'G':
		d[4] += 1
	if f + 1 < n and a[f + 1] != 'B':
		d[4] += 1
	if f + 2 < n and a[f + 2] != 'R':
		d[4] += 1
	f += 3
g = 0
while g < n:
	if a[g] != 'B':
		d[5] += 1
	if g + 1 < n and a[g + 1] != 'R':
		d[5] += 1
	if g + 2 < n and a[g + 2] != 'G':
		d[5] += 1
	g += 3
j = d.index(min(d))
k = 0
print(d[j])
if n % 3 == 0:
	print(ar[j] * (n // 3))
elif n % 3 == 1:
	print(ar[j] * (n // 3) + ar[j][0])
elif n % 3 == 2:
	print(ar[j] * (n // 3) + ar[j][0] + ar[j][1])


num = int(input())
word = input()
changes = []
cur = ''
for i in range(num):
	if word[i] != cur:
		cur = word[i]
		changes.append(i)
use = []
cur = ''
index = 0
m = len(changes)
for i in range(num):
	if changes[index] == i:
		index += 1
		if index == m:
			changes.append(-1)
		t = {'R', 'G', 'B'}
		try:
			t.remove(word[changes[index - 1]])
			t.remove(word[changes[index]])
		except:
			pass
		cur = t.pop()
	use.append(cur)
cur = 'Q'
count = 0
out = ''
for i in range(num):
	l = word[i]
	if l == cur:
		out += use[i]
		cur = use[i]
		count += 1
	else:
		out += l
		cur = l
print(count)
print(out)


def main():
	if input() == '1':
		print(f'0\n{input()}')
		return
	(a, b, *l) = map({'R': 0, 'G': 1, 'B': 2}.get, input())
	l.append((l[-1] + 1) % 3 if l else a)
	(res, cnt) = (['RGB'[a]], 0)
	for c in l:
		if b == a:
			b = a - 2 if a == c else 3 - a - c
			cnt += 1
		res.append('RGB'[b])
		(a, b) = (b, c)
	print(cnt)
	print(''.join(res))
main()


n = input()
s = input()
(RED, GREEN, BLUE) = ('R', 'G', 'B')
prev = []
dp = {RED: 0, GREEN: 0, BLUE: 0}
for c in s:
	(r, g, b) = (dp[RED], dp[GREEN], dp[BLUE])
	prev.append({RED: GREEN if g < b else BLUE, GREEN: RED if r < b else BLUE, BLUE: RED if r < g else GREEN})
	dp[RED] = min(g, b) + (0 if c == RED else 1)
	dp[GREEN] = min(r, b) + (0 if c == GREEN else 1)
	dp[BLUE] = min(r, g) + (0 if c == BLUE else 1)
assert len(prev) == len(s)
min_ = RED
if dp[GREEN] < dp[min_]:
	min_ = GREEN
if dp[BLUE] < dp[min_]:
	min_ = BLUE
output = [min_]
while prev:
	last = prev.pop()
	min_ = last[min_]
	if prev:
		output.append(min_)
assert len(output) == len(s)
print(min(dp[RED], dp[GREEN], dp[BLUE]))
print(''.join(reversed(output)))


def get_diff(prev, nxt):
	s = ['R', 'G', 'B']
	s.remove(prev)
	if prev != nxt:
		s.remove(nxt)
	return s[0]

def func(s):
	count = 0
	for i in range(1, len(s)):
		if s[i] == s[i - 1]:
			s[i] = get_diff(s[i - 1], s[i + 1] if i + 1 < len(s) else s[i])
			count += 1
	print(count)
	print(''.join(s))
N = input()
s = input()
func(list(s))


n = int(input())
s = input()
m = 200001
c = 0
l = ''
for i in range(n):
	r = i % 3
	if r == 0 and s[i] != 'R' or (r == 1 and s[i] != 'G') or (r == 2 and s[i] != 'B'):
		c += 1
if c < m:
	m = c
	l = 'rgb'
c = 0
for i in range(n):
	r = i % 3
	if r == 0 and s[i] != 'R' or (r == 1 and s[i] != 'B') or (r == 2 and s[i] != 'G'):
		c += 1
if c < m:
	m = c
	l = 'rbg'
c = 0
for i in range(n):
	r = i % 3
	if r == 0 and s[i] != 'G' or (r == 1 and s[i] != 'B') or (r == 2 and s[i] != 'R'):
		c += 1
if c < m:
	m = c
	l = 'gbr'
c = 0
for i in range(n):
	r = i % 3
	if r == 0 and s[i] != 'G' or (r == 1 and s[i] != 'R') or (r == 2 and s[i] != 'B'):
		c += 1
if c < m:
	m = c
	l = 'grb'
c = 0
for i in range(n):
	r = i % 3
	if r == 0 and s[i] != 'B' or (r == 1 and s[i] != 'R') or (r == 2 and s[i] != 'G'):
		c += 1
if c < m:
	m = c
	l = 'brg'
c = 0
for i in range(n):
	r = i % 3
	if r == 0 and s[i] != 'B' or (r == 1 and s[i] != 'G') or (r == 2 and s[i] != 'R'):
		c += 1
if c < m:
	m = c
	l = 'bgr'
print(m)
if l == 'rgb':
	for i in range(n):
		if i % 3 == 0:
			print('R', end='')
		elif i % 3 == 1:
			print('G', end='')
		else:
			print('B', end='')
elif l == 'rbg':
	for i in range(n):
		if i % 3 == 0:
			print('R', end='')
		elif i % 3 == 1:
			print('B', end='')
		else:
			print('G', end='')
elif l == 'gbr':
	for i in range(n):
		if i % 3 == 0:
			print('G', end='')
		elif i % 3 == 1:
			print('B', end='')
		else:
			print('R', end='')
elif l == 'grb':
	for i in range(n):
		if i % 3 == 0:
			print('G', end='')
		elif i % 3 == 1:
			print('R', end='')
		else:
			print('B', end='')
elif l == 'bgr':
	for i in range(n):
		if i % 3 == 0:
			print('B', end='')
		elif i % 3 == 1:
			print('G', end='')
		else:
			print('R', end='')
else:
	for i in range(n):
		if i % 3 == 0:
			print('B', end='')
		elif i % 3 == 1:
			print('R', end='')
		else:
			print('G', end='')


clr = 'RGB'
n = int(input())
l = [clr.index(c) for c in input()] + [3]
m = 0
for i in range(1, n):
	if l[i] == l[i - 1]:
		m += 1
		l[i] = (l[i] + 1) % 3
		if l[i] == l[i + 1]:
			l[i] = (l[i] + 1) % 3
print(m)
print(''.join((clr[i] for i in l[:-1])))


q = int(input())
s = input()
val = q
for t in ('RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR'):
	temp = 0
	for i in range(q):
		if s[i] != t[i % 3]:
			temp += 1
	if val >= temp:
		val = temp
		ans = t * (q // 3) + t[:q % 3]
print(val)
print(ans)


n = int(input())
s = list(input())
s.append('B')
_SET = {'R', 'G', 'B'}

def trzeci(x, y):
	return list(_SET - {x, y})[0]
wyn = 0
for i in range(n - 1):
	if s[i] == s[i + 1]:
		s[i + 1] = trzeci(s[i], s[i + 2])
		wyn += 1
print(wyn, ''.join(s[:n]), sep='\n')


def change(color1, color2):
	r = 'R'
	g = 'G'
	b = 'B'
	if color1 == color2:
		if color1 == r:
			return g
		else:
			return r
	elif color1 == r:
		if color2 == g:
			return b
		else:
			return g
	elif color1 == g:
		if color2 == r:
			return b
		else:
			return r
	elif color2 == r:
		return g
	else:
		return r
n = int(input())
ans = 0
colors = input()
x = list(colors)
x.append('R')
for j in range(len(x) - 2):
	if x[j + 1] == x[j]:
		ans = ans + 1
		x[j + 1] = change(x[j], x[j + 2])
del x[-1]
x1 = ''.join(x)
print(ans)
print(x1)


import sys
input = sys.stdin.readline
n = int(input())
S = list(input())
ANS = 0
LIST = ['R', 'G', 'B']
for i in range(1, n):
	if S[i] == S[i - 1]:
		if i < n - 1:
			for l in LIST:
				if S[i - 1] != l and S[i + 1] != l:
					ANS += 1
					S[i] = l
					break
		else:
			for l in LIST:
				if S[i - 1] != l:
					ANS += 1
					S[i] = l
					break
print(ANS)
print(''.join(S))


def deal(na, nb, nc='0'):
	if nc == '0' or na == nc:
		if na == 'R':
			return 'B'
		if na == 'G':
			return 'B'
		if na == 'B':
			return 'R'
	if na == 'B' and nc == 'G':
		nb = 'R'
	if na == 'G' and nc == 'B':
		nb = 'R'
	if na == 'G' and nc == 'R':
		nb = 'B'
	if na == 'R' and nc == 'B':
		nb = 'G'
	if na == 'R' and nc == 'G':
		nb = 'B'
	if na == 'B' and nc == 'R':
		nb = 'G'
	return nb
nas = int(input())
number = 0
str = input()
t = list(str)
answer = [t[0]]
for i in range(0, nas - 1):
	ans = ''
	if t[i + 1] == t[i]:
		number = number + 1
		if i == nas - 2:
			ans = deal(t[i], t[i + 1])
		else:
			ans = deal(t[i], t[i + 1], t[i + 2])
		t[i + 1] = ans
		answer.append(ans)
	else:
		answer.append(t[i + 1])
t = ''.join(answer)
print(number)
print(t)


def generate_base():
	for first in 'RGB':
		for second in 'RGB':
			if second == first:
				continue
			for third in 'RGB':
				if third == first or third == second:
					continue
				yield ('%s%s%s' % (first, second, third))

def generate_lamps(base, length):
	for index in range(length):
		yield base[index % 3]

def calculate_cost(original, destination):
	cost = 0
	for (index, letter) in enumerate(destination):
		if letter != original[index]:
			cost += 1
	return cost

def generate(original):
	for base in generate_base():
		destination = ''.join(generate_lamps(base, len(original)))
		cost = calculate_cost(original, destination)
		yield (cost, destination)
input()
lamps = input()
print(*min(generate(lamps), key=lambda x: x[0]), sep='\n')


import math
from itertools import permutations, cycle

def process_range(arr, from_, to_):
	l = to_ - from_
	change_to = list('RGB')
	change_to.remove(arr[from_])
	if l % 2 == 0 and to_ != len(arr):
		change_to.remove(arr[to_])
	change_to = change_to[0]
	changes = 0
	for i in range(from_ + 1, to_, 2):
		arr[i] = change_to
		changes += 1
	return changes
n = int(input())
s = input()
changes = 0
arr = list(s)
cur = arr[0]
curl = 1
for i in range(1, n):
	if arr[i] == cur:
		curl += 1
	else:
		if curl > 1:
			changes += process_range(arr, i - curl, i)
		curl = 1
		cur = arr[i]
if curl > 1:
	changes += process_range(arr, n - curl, n)
print(changes)
print(''.join(arr))


import math
n = int(input())
s = input()
s1 = 'RGB'
s2 = 'RBG'
s3 = 'GBR'
s4 = 'GRB'
s5 = 'BRG'
s6 = 'BGR'
if len(s) == 1:
	print(0)
	print(s)
else:
	count = 0
	count1 = count2 = count3 = count4 = count5 = count6 = 0
	n1 = n / 3
	n1 = math.ceil(n1)
	check1 = s5 * n1
	check2 = s6 * n1
	check1 = s1 * n1
	check2 = s2 * n1
	check3 = s3 * n1
	check4 = s4 * n1
	check5 = s5 * n1
	check6 = s6 * n1
	for i in range(0, n):
		if check1[i] != s[i]:
			count1 = count1 + 1
		if check2[i] != s[i]:
			count2 = count2 + 1
		if check3[i] != s[i]:
			count3 = count3 + 1
		if check4[i] != s[i]:
			count4 = count4 + 1
		if check5[i] != s[i]:
			count5 = count5 + 1
		if check6[i] != s[i]:
			count6 = count6 + 1
	l = [count1, count2, count3, count4, count5, count6]
	m = l.index(min(l))
	if m == 0:
		print(l[0])
		print(check1[:n])
	elif m == 1:
		print(l[1])
		print(check2[:n])
	elif m == 2:
		print(l[2])
		print(check3[:n])
	elif m == 3:
		print(l[3])
		print(check4[:n])
	elif m == 4:
		print(l[4])
		print(check5[:n])
	else:
		print(l[5])
		print(check6[:n])


n = int(input())
a = list(input())
c = 1
prev = a[0]
arr = []
for i in range(1, n):
	if a[i] == prev:
		c += 1
	else:
		prev = a[i]
		c = 1
	if c > 1 and c % 2 == 0:
		arr.append(i)
s = 'RBG'
for i in range(len(arr)):
	if arr[i] == n - 1:
		if a[arr[i]] != 'R':
			a[arr[i]] = 'R'
		elif a[arr[i]] != 'B':
			a[arr[i]] = 'B'
		elif a[arr[i]] != 'G':
			a[arr[i]] = 'G'
	elif a[arr[i]] != 'R' and a[arr[i] + 1] != 'R':
		a[arr[i]] = 'R'
	elif a[arr[i]] != 'B' and a[arr[i] + 1] != 'B':
		a[arr[i]] = 'B'
	elif a[arr[i]] != 'G' and a[arr[i] + 1] != 'G':
		a[arr[i]] = 'G'
print(len(arr))
for i in range(len(a)):
	print(a[i], end='')


n = int(input())
s = input()
if n == 1:
	print(0)
	print(s)
	exit()
a = []
lst = s[0]
new = s[0]
for i in range(1, n):
	if i == n - 1 and s[i] == lst:
		new += s[i]
		a.append(new)
	elif i == n - 1 and s[i] != lst:
		a.append(new)
		a.append(s[i])
	elif s[i] == lst:
		new += s[i]
	else:
		a.append(new)
		new = s[i]
		lst = s[i]
d = len(a)
new = ''
k = 0
for i in range(d - 1):
	if len(a[i]) % 2 == 1:
		k += len(a[i]) // 2
		if len(a[i]) == 1:
			new += a[i]
		else:
			if a[i][0] == 'R':
				for j in range(len(a[i])):
					if j % 2 == 0:
						new += a[i][j]
					else:
						new += 'B'
			if a[i][0] == 'G':
				for j in range(len(a[i])):
					if j % 2 == 0:
						new += a[i][j]
					else:
						new += 'B'
			if a[i][0] == 'B':
				for j in range(len(a[i])):
					if j % 2 == 0:
						new += a[i][j]
					else:
						new += 'R'
	else:
		isk = set('RGB')
		k += len(a[i]) // 2
		el = isk - set(a[i][0]) - set(a[i + 1][0])
		for j in range(len(a[i])):
			if j % 2 == 0:
				new += a[i][j]
			else:
				new += sorted(el)[0]
k += len(a[d - 1]) // 2
if a[d - 1][0] == 'R':
	for j in range(len(a[d - 1])):
		if j % 2 == 0:
			new += a[d - 1][j]
		else:
			new += 'B'
if a[d - 1][0] == 'G':
	for j in range(len(a[d - 1])):
		if j % 2 == 0:
			new += a[d - 1][j]
		else:
			new += 'B'
if a[d - 1][0] == 'B':
	for j in range(len(a[d - 1])):
		if j % 2 == 0:
			new += a[d - 1][j]
		else:
			new += 'R'
print(k)
print(new)


n = int(input())
s = input()
if n == 1:
	print('0')
	print(s)
else:
	count = 0
	l = []
	indexl = []
	dis = list(s)
	for i in range(1, n - 1):
		if dis[i] == dis[i - 1]:
			count += 1
			if s[i] == 'R':
				if s[i + 1] == 'R':
					dis[i] = 'G'
				if s[i + 1] == 'G':
					dis[i] = 'B'
				if s[i + 1] == 'B':
					dis[i] = 'G'
			if s[i] == 'B':
				if s[i + 1] == 'R':
					dis[i] = 'G'
				if s[i + 1] == 'G':
					dis[i] = 'R'
				if s[i + 1] == 'B':
					dis[i] = 'G'
			if s[i] == 'G':
				if s[i + 1] == 'R':
					dis[i] = 'B'
				if s[i + 1] == 'G':
					dis[i] = 'B'
				if s[i + 1] == 'B':
					dis[i] = 'R'
	if dis[n - 1] == dis[n - 2]:
		count += 1
		if s[n - 1] == 'R':
			dis[n - 1] = 'B'
		if s[n - 1] == 'G':
			dis[n - 1] = 'B'
		if s[n - 1] == 'B':
			dis[n - 1] = 'R'
	if count == 0:
		print('0')
		print(s)
	else:
		print(count)
		print(''.join(dis))


n = int(input())
s = list(input())
ans = 0
for i in range(n - 2):
	if s[i] == s[i + 1]:
		s[i + 1] = ({'R', 'G', 'B'} ^ {s[i], s[i + 2]}).pop()
		ans += 1
if n > 1 and s[-2] == s[-1]:
	s[-1] = ({'R', 'G', 'B'} ^ {s[-1]}).pop()
	ans += 1
print(ans)
print(''.join(s))


from sys import stdin, stdout
a = int(stdin.readline())
b = stdin.readline()
k = []
from itertools import permutations as p
for i in list(p('BGR')):
	r = ''.join(i)
	k += [r * (a // 3) + r[:a % 3]]
z = [0] * 6
for i in range(a):
	for j in range(6):
		z[j] += 0 + (k[j][i] == b[i])
b = z.index(max(z))
stdout.write(str(a - max(z)) + ' ' + k[b])


n = int(input())
s = list(input())
res = 0
for i in range(1, n):
	if i == n - 1:
		if s[i] == s[i - 1]:
			res += 1
			if s[i] == 'R':
				s[i] = 'G'
			else:
				s[i] = 'R'
	else:
		(x, y, z) = (s[i], s[i - 1], s[i + 1])
		if x == y:
			res += 1
			if x == z:
				if x == 'R':
					s[i] = 'G'
				else:
					s[i] = 'R'
			else:
				if x != 'R' and z != 'R':
					s[i] = 'R'
				if x != 'G' and z != 'G':
					s[i] = 'G'
				if x != 'B' and z != 'B':
					s[i] = 'B'
print(res)
print(''.join(s))


input()
s = input()
colors = ['R', 'G', 'B']
colors2 = ['R', 'B', 'G']
mm = [0] * 6
i = 0
for c in s:
	for j in range(3):
		if c != colors[(i + j) % 3]:
			mm[j] += 1
		if c != colors2[(i + j) % 3]:
			mm[j + 3] += 1
	i += 1
	i %= 3
m = min(mm)
print(m)
mi = mm.index(m)
if mi == 0:
	ss = 'RGB'
elif mi == 1:
	ss = 'GBR'
elif mi == 2:
	ss = 'BRG'
elif mi == 3:
	ss = 'RBG'
elif mi == 4:
	ss = 'BGR'
else:
	ss = 'GRB'
print(ss * (len(s) // 3) + ss[:len(s) % 3])


num_of_lamps = int(input())
colours_of_lamps = input()
garland = ''
changed_lamps_amount = ''
for colour in ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']:
	temp_garland = colour * (num_of_lamps // 3) + colour[:num_of_lamps % 3]
	temp_changed_lamps_amount = sum(list(map(lambda x, y: 1 if x != y else 0, colours_of_lamps, temp_garland)))
	if changed_lamps_amount == '':
		changed_lamps_amount = temp_changed_lamps_amount
		garland = temp_garland
	if changed_lamps_amount > temp_changed_lamps_amount:
		changed_lamps_amount = temp_changed_lamps_amount
		garland = temp_garland
print(changed_lamps_amount)
print(garland)


n = int(input())
s = list(input())
dp = [[0 for i in range(3)] for i in range(n)]
rec = {'R': 0, 'G': 1, 'B': 2}
recInv = {0: 'R', 1: 'G', 2: 'B'}
dp[0][rec[s[0]]] = 0
dp[0][(rec[s[0]] - 1) % 3] = 1
dp[0][(rec[s[0]] + 1) % 3] = 1
for i in range(1, n):
	dp[i][rec[s[i]]] = min(dp[i - 1][(rec[s[i]] - 1) % 3], dp[i - 1][(rec[s[i]] + 1) % 3])
	dp[i][(rec[s[i]] - 1) % 3] = 1 + min(dp[i - 1][(rec[s[i]] - 1 - 1) % 3], dp[i - 1][rec[s[i]] % 3])
	dp[i][(rec[s[i]] + 1) % 3] = 1 + min(dp[i - 1][rec[s[i]] % 3], dp[i - 1][(rec[s[i]] + 2) % 3])
result = ['' for i in range(n)]
if dp[n - 1][0] == min(dp[n - 1]):
	temp = 0
elif dp[n - 1][1] == min(dp[n - 1]):
	temp = 1
else:
	temp = 2
result[n - 1] = recInv[temp]
for i in range(n - 2, -1, -1):
	if dp[i][(temp - 1) % 3] == min(dp[i][(temp - 1) % 3], dp[i][(temp + 1) % 3]):
		temp = (temp - 1) % 3
	else:
		temp = (temp + 1) % 3
	result[i] = recInv[temp]
print(min(dp[n - 1]))
print(''.join(result))


import random
n = int(input())
input_str = list(input())
color = set(['R', 'G', 'B'])
changes = 0
i = 1
if n != 1:
	while i < n - 1:
		if input_str[i] == input_str[i - 1]:
			options = color - set([input_str[i], input_str[i + 1]])
			input_str[i] = random.choice(tuple(options))
			changes += 1
		i += 1
	if input_str[i] == input_str[i - 1]:
		options = color - set(input_str[i])
		input_str[i] = random.choice(tuple(options))
		changes += 1
print(changes)
print(''.join(input_str))


def get(a, b, c):
	if a == c:
		return alphabet[(inv_alphabet[a] + 1) % 3]
	else:
		return alphabet[3 - inv_alphabet[a] - inv_alphabet[c]]
alphabet = {0: 'R', 1: 'G', 2: 'B'}
inv_alphabet = {'R': 0, 'G': 1, 'B': 2}
n = int(input())
garland = input()
dp = [0, 0]
if n > 1 and garland[0] == garland[1]:
	dp[1] = 1
for i in range(2, n):
	if garland[i] != garland[i - 1]:
		dp.append(dp[i - 1])
	else:
		dp.append(min(dp[i - 1], dp[i - 2]) + 1)
print(dp[n - 1])
garland += alphabet[(inv_alphabet[garland[n - 1]] + 1) % 3]
garland = list(garland)
for i in range(n - 1, 1, -1):
	if dp[i] != dp[i - 1]:
		if dp[i - 1] <= dp[i - 2]:
			garland[i] = get(garland[i - 1], garland[i], garland[i + 1])
if n > 1:
	garland[1] = get(garland[0], garland[1], garland[2])
print(''.join(garland[:n]))


n = int(input())
s = input()
ans = ['0'] * n
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if s == 'RR':
		print(1)
		print('RB')
	elif s == 'BB':
		print(1)
		print('RB')
	elif s == 'GG':
		print(1)
		print('GB')
else:
	ct = 0
	ans = list(s)
	for i in range(n - 2):
		if ans[i] == ans[i + 1]:
			for c in 'RGB':
				if ans[i + 2] != c and ans[i] != c:
					ans[i + 1] = c
					break
	if ans[-2] == ans[-3]:
		for c in 'RGB':
			if ans[-1] != c and ans[-3] != c:
				ans[-2] = c
				break
	elif ans[-2] == ans[-1]:
		for c in 'RGB':
			if ans[-2] != c:
				ans[-1] = c
				break
	ans = ''.join(ans)
	for (i, j) in zip(ans, s):
		if i != j:
			ct += 1
	print(ct)
	print(ans)


n = int(input())
s = input()
s = list(s)
r = [] + s
c = ['R', 'G', 'B']
i = 0
while i < n - 1:
	if i == n - 2 and s[i] == s[i + 1]:
		x = [a for a in c if a != s[i + 1]]
		s[i + 1] = x[0]
	elif s[i] == s[i + 1]:
		x = [a for a in c if a != s[i + 1] and a != s[i + 2]]
		s[i + 1] = x[0]
	i += 1
ans = 0
for i in range(n):
	if r[i] != s[i]:
		ans += 1
print(ans)
print(''.join(s))


def equal(x, y='k'):
	if x != 'R' and y != 'R':
		c = 'R'
	elif x != 'B' and y != 'B':
		c = 'B'
	elif x != 'G' and y != 'G':
		c = 'G'
	return c
(n, s, count) = (int(input()), input(), 0)
ans = [s[0]]
for i in range(1, n):
	c = s[i]
	if s[i] == ans[i - 1]:
		if i < n - 1:
			c = equal(ans[i - 1], s[i + 1])
		else:
			c = equal(s[i - 1])
		count += 1
	ans.append(c)
print(count, ''.join(ans), sep='\n')


import sys
input = lambda : sys.stdin.readline().strip()
ipnut = input
n = int(input())
ger = list(ipnut())
lol = ['R', 'G', 'B']
an = 0
ans = [[ger[0]]]
for i in range(n - 1):
	if ans[-1][-1] == ger[i + 1]:
		ans[-1].append(ger[i + 1])
	else:
		ans.append([ger[i + 1]])
for h in range(len(ans)):
	j = ans[h]
	for k in lol:
		if k != j[0] and k != ans[(h + 1) % len(ans)][0]:
			nice = k
			break
	if len(j) - 1:
		for i in range(len(j)):
			if i % 2:
				an += 1
				j[i] = nice
	ans[h] = j
print(an)
for j in ans:
	print(''.join(j), end='')


n = int(input())
s = list(input())
col = [['R', 'G', 'B'], ['R', 'B', 'G'], ['G', 'B', 'R'], ['G', 'R', 'B'], ['B', 'G', 'R'], ['B', 'R', 'G']]
R = []
for j in range(6):
	count = 0
	r = 0
	for i in range(n):
		if s[i] != col[j][i - r]:
			count = count + 1
		if i % 3 == 0:
			r = r + 3
	R.append(count)
print(min(R))
ind = R.index(min(R))
r = 0
for i in range(n):
	if s[i] != col[ind][i - r]:
		s[i] = col[ind][i - r]
	if i % 3 == 0:
		r = r + 3
print(''.join(s))


li = ['RGB' * 200005, 'RBG' * 200005, 'GRB' * 200005, 'GBR' * 200005, 'BRG' * 200005, 'BGR' * 200005]
n = int(input())
lis = input()
ans = 10000000000
ind = 0
for i in range(6):
	a = li[i]
	c = 0
	for j in range(n):
		if a[j] != lis[j]:
			c += 1
	if c < ans:
		ans = c
		ind = i
print(ans)
print(li[ind][:n])


import itertools
n = int(input())
s = input()
R = range(3)
d = {0: 'R', 1: 'G', 2: 'B'}
t = ''
num = float('inf')
for (i, j, k) in itertools.permutations(R, 3):
	d1 = [d[i], d[j], d[k]]
	tmp = ''
	cnt = 0
	for p in range(n):
		if s[p] != d1[p % 3]:
			cnt += 1
			tmp += d1[p % 3]
		else:
			tmp += s[p]
	if cnt < num:
		num = cnt
		t = tmp
print(num)
print(t)


n = int(input())
a = input()
if n <= 2:
	if n == 1:
		print(0)
		print(a)
	elif a[0] == a[1]:
		print(1)
		if a == 'RR':
			print('RB')
		if a == 'BB':
			print('RB')
		if a == 'GG':
			print('GB')
	else:
		print(0)
		print(a)
else:
	b = ['RGB', 'RBG', 'GBR', 'GRB', 'BGR', 'BRG']
	c = []
	d = []
	for i in b:
		l = 0
		s = i * (n // 3)
		s += i[:n % 3]
		for j in range(n):
			if a[j] != s[j]:
				l = l + 1
		c.append(l)
		d.append(s)
	r = min(c)
	for i in range(6):
		if c[i] == r:
			print(r)
			print(d[i])
			break


n = int(input())
s = input()
c = 'RGB'
ans = ''
ansk = 0
flag = True
for i in range(n - 1):
	if flag:
		if s[i] == s[i + 1]:
			if i == n - 2:
				ans += s[i] + c[c.find(s[i]) - 1]
				ansk += 1
				print(ansk)
				print(ans)
				exit()
			else:
				for j in c:
					if j != s[i] and j != s[i + 2]:
						break
				flag = False
				ansk += 1
				ans += s[i] + j
		else:
			ans += s[i]
	else:
		flag = True
print(ansk)
print(ans + s[-1])


n = int(input())
s = input()
a = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
mn = n * 3
new = ''
for i in range(6):
	neww = ''
	tc = 0
	for j in range(2, n, 3):
		neww += a[i]
		if s[j - 2] != a[i][0]:
			tc += 1
		if s[j - 1] != a[i][1]:
			tc += 1
		if s[j] != a[i][2]:
			tc += 1
	k = n % 3
	j = 0
	jj = 1
	while j < k:
		neww += a[i][j]
		if s[n // 3 * 3 - 1 + jj] != a[i][j]:
			tc += 1
		j += 1
		jj += 1
	if tc < mn:
		new = neww
		mn = tc
print(mn)
print(new)


n = int(input())
s = input()
R = [0, 0, 0]
G = [0, 0, 0]
B = [0, 0, 0]
perm = [(0, 1, 2), (1, 2, 0), (1, 0, 2), (0, 2, 1), (2, 1, 0), (2, 0, 1)]
for i in range(n):
	if s[i] == 'R':
		R[i % 3] += 1
	elif s[i] == 'G':
		G[i % 3] += 1
	else:
		B[i % 3] += 1
ans = n
tup = (0, 1, 2)
for i in perm:
	temp = 0
	for j in range(3):
		if j != i[0]:
			temp += R[j]
	for j in range(3):
		if j != i[1]:
			temp += G[j]
	for j in range(3):
		if j != i[2]:
			temp += B[j]
	if temp < ans:
		ans = temp
		tup = i
s = ''
i = tup
d = {i[0]: 'R', i[1]: 'G', i[2]: 'B'}
for i in range(n):
	s += d[i % 3]
print(ans, s, sep='\n')


n = int(input())
l = list(input())
l.append('R')
check = 'RGB'
res = 0
for i in range(1, n):
	if l[i - 1] == l[i]:
		for c in check:
			if l[i - 1] != c and l[i + 1] != c:
				l[i] = c
				res += 1
				break
print(res)
print(''.join(l[:-1]))


import sys

def fprint(x):
	print(x, flush=True)

def qprint(x):
	sys.stdout.write(str(x) + '\n')

def input():
	return sys.stdin.readline()
n = int(input())
garland = input()
new_garland = [item for item in garland]
index = 0
changes = 0
while index <= len(garland) - 2:
	cur_ele = garland[index]
	begin = index
	index += 1
	while index <= len(garland) - 2 and garland[index] == cur_ele:
		index += 1
	last = index - 1
	if begin != last:
		if begin - last == 1:
			if begin == 0:
				if garland[begin] == 'R':
					new_garland[begin] = 'G'
					changes += 1
			else:
				choice = ['R', 'G', 'B']
				choice.remove(garland[begin])
				choice.remove(garland[begin - 1])
				new_garland[begin] = choice.pop()
				changes += 1
		elif (begin - last) % 2 == 0:
			to_ch = begin + 1
			choice = ['R', 'G', 'B']
			choice.remove(garland[begin])
			while to_ch < last:
				new_garland[to_ch] = choice[0]
				changes += 1
				to_ch += 2
		else:
			to_ch = begin + 1
			choice = ['R', 'G', 'B']
			choice.remove(garland[begin])
			while to_ch < last:
				new_garland[to_ch] = choice[0]
				changes += 1
				to_ch += 2
			if to_ch != len(garland) - 2:
				choice.remove(garland[last + 1])
			new_garland[to_ch] = choice.pop()
			changes += 1
print(changes)
print(''.join(new_garland))


amount = int(input())
string = input()
new_string = ''
symbols = ['R', 'G', 'B']
counter = 0
i = 0
while i < len(string) - 1:
	if string[i] == string[i + 1]:
		counter += 1
		idx = symbols.index(string[i])
		idx_2 = -1
		new_string += string[i]
		if i + 2 < len(string):
			idx_2 = symbols.index(string[i + 2])
		if idx_2 == -1:
			for j in range(len(symbols)):
				if j != idx and j != idx_2:
					new_string += symbols[j]
					break
		else:
			for j in range(len(symbols)):
				if j != idx and j != idx_2:
					new_string += symbols[j]
					break
		i += 2
	else:
		new_string += string[i]
		i += 1
if i == len(string) - 1:
	new_string += string[len(string) - 1]
print(counter)
print(new_string)


n = int(input())
l = ['R', 'B', 'G']
lamp = list(input())
if n == 1:
	print(0)
	print(lamp[0])
else:
	cnt = 0
	for i in range(1, n - 1):
		if lamp[i] == lamp[i - 1]:
			if lamp[i] == lamp[i + 1]:
				index = l.index(lamp[i - 1]) + 1
				index %= 3
				lamp[i] = l[index]
			else:
				index = 3 - l.index(lamp[i - 1]) - l.index(lamp[i + 1])
				lamp[i] = l[index]
			cnt += 1
	if lamp[-1] == lamp[-2]:
		index = l.index(lamp[-2]) + 1
		index %= 3
		lamp[-1] = l[index]
		cnt += 1
	print(cnt)
	print(''.join(lamp))


n = int(input())
arr = list(input().strip())
k = 0
S = ['R', 'G', 'B']
for i in range(1, n - 1):
	if arr[i] == arr[i - 1]:
		idx = S.index(arr[i])
		idx1 = S.index(arr[i + 1])
		if idx == idx1:
			idx = (idx + 1) % 3
			arr[i] = S[idx]
			k += 1
		else:
			tmp = 3 - idx - idx1
			arr[i] = S[tmp]
			k += 1
if n >= 2:
	if arr[n - 1] == arr[n - 2]:
		idx = S.index(arr[n - 1])
		idx = (idx + 1) % 3
		arr[n - 1] = S[idx]
		k += 1
print(k)
print(''.join(arr))


n = int(input())
s = input()
(r, t) = min(((sum((x != y for (x, y) in zip(s, t * n))), t) for t in ('RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR')))
print(r, (t * n)[:n])


n = int(input())
a = input()
b = ['BRG', 'BGR', 'RGB', 'RBG', 'GBR', 'GRB']

def match(a, p):
	i = 0
	b = ''
	x = 0
	for r in a:
		x += p[i] != r
		b += p[i]
		i += 1
		i %= 3
	return [x, b]
c = {}
k = []
for r in b:
	(m, n) = match(a, r)
	k.append(m)
	c[m] = n
print(min(k))
print(c[min(k)])


import sys

def c(lo, mid, hi):
	col = ['R', 'B', 'G']
	for c in col:
		mid = c
		if lo != mid and mid != hi:
			return mid

def recolor(colors, n):
	change = 0
	for i in range(1, n):
		if colors[i - 1] == colors[i]:
			change += 1
			for ch in 'RBG':
				if ch != colors[i - 1] and ch != colors[i + 1]:
					colors[i] = ch
	print(change)
	print(''.join(colors[0:-1]))

def main():
	n = int(sys.stdin.readline())
	arr = list(sys.stdin.readline() + '.')
	recolor(arr, n)
main()


import sys

def input():
	return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
N = int(input())
S = list(input())
ans = INF
colors = 'RGB'
cnt = 0
for i in range(1, len(S) - 1):
	if S[i - 1] == S[i] and S[i] != S[i + 1]:
		s = colors.replace(S[i - 1], '').replace(S[i + 1], '')
		cnt += 1
	elif S[i - 1] == S[i] == S[i + 1]:
		if S[i] == 'R':
			s = 'G'
		elif S[i] == 'G':
			s = 'B'
		elif S[i] == 'B':
			s = 'R'
		cnt += 1
	else:
		s = S[i]
	S[i] = s
if N >= 2 and S[-2] == S[-1]:
	if S[-1] == 'R':
		s = 'G'
	elif S[-1] == 'G':
		s = 'B'
	elif S[-1] == 'B':
		s = 'R'
	cnt += 1
	S[-1] = s
print(cnt)
print(''.join(S))


n = int(input())
string = input()
string = list(string)
i = 0
result = 0
color = list('RGB')
while i < n - 1:
	if string[i] == string[i + 1]:
		if i < n - 2:
			if string[i + 1] == string[i + 2]:
				j = 0
				while j < 3:
					if color[j] != string[i + 1]:
						string[i + 1] = color[j]
						break
					j += 1
			else:
				j = 0
				while j < 3:
					if color[j] != string[i] and color[j] != string[i + 2]:
						string[i + 1] = color[j]
						break
					j += 1
		else:
			j = 0
			while j < 3:
				if color[j] != string[i]:
					string[i + 1] = color[j]
					break
				j += 1
		i += 2
		result += 1
	else:
		i += 1
print(result)
i = 0
while i < len(string):
	print(string[i], end='')
	i += 1


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

def create(p, n):
	q = n // 3
	n = n % 3
	if q == 0:
		for i in range(6):
			p[i] = p[i][:n]
	else:
		for i in range(6):
			p[i] = p[i] * q
			p[i] = p[i] + p[i][:n]
	return p
n = int(input())
a = str(input())
q = create(p, n)
m = 10 ** 9
for j in range(6):
	l = 0
	for i in range(n):
		if p[j][i] != a[i]:
			l = l + 1
	if l < m:
		s = p[j]
		m = l
print(m)
print(s)


n = int(input())
s = input()
r = [0] * n
g = [0] * n
b = [0] * n
if s[0] == 'R':
	b[0] = 1
	g[0] = 1
if s[0] == 'G':
	b[0] = 1
	r[0] = 1
if s[0] == 'B':
	r[0] = 1
	g[0] = 1
for i in range(1, n):
	if s[i] == 'R':
		r[i] = min(b[i - 1], g[i - 1])
		g[i] = 1 + min(r[i - 1], b[i - 1])
		b[i] = 1 + min(r[i - 1], g[i - 1])
	if s[i] == 'G':
		g[i] = min(r[i - 1], b[i - 1])
		r[i] = 1 + min(b[i - 1], g[i - 1])
		b[i] = 1 + min(r[i - 1], g[i - 1])
	if s[i] == 'B':
		b[i] = min(r[i - 1], g[i - 1])
		g[i] = 1 + min(r[i - 1], b[i - 1])
		r[i] = 1 + min(b[i - 1], g[i - 1])
a = min(r[n - 1], g[n - 1], b[n - 1])
print(a)
c = 'c'
ans = []
for i in range(n - 1, -1, -1):
	if r[i] == a and c != 'R':
		ans.append('R')
		c = 'R'
		if s[i] != c:
			a -= 1
	elif g[i] == a and c != 'G':
		ans.append('G')
		c = 'G'
		if s[i] != c:
			a -= 1
	else:
		ans.append('B')
		c = 'B'
		if s[i] != c:
			a -= 1
print(''.join(ans)[::-1])


import sys
input = sys.stdin.readline
n = int(input())
s = input()
if n == 1:
	print(0)
	print(s)
	exit()
answer = ['0'] * n
shomarande = 1
answer[0] = s[0]
a = 0
b = 0
if s[1] == s[0]:
	b = 1
for i in range(2, n):
	if s[i] == s[i - 1]:
		c = min(a, b) + 1
		(a, b) = (b, c)
		if s[i] != answer[shomarande - 1]:
			answer[shomarande] = s[i]
		elif s[i] != 'B':
			answer[shomarande] = 'B'
		else:
			answer[shomarande] = 'R'
	else:
		if s[i - 1] == answer[shomarande - 1]:
			o = [s[i], answer[shomarande - 1]]
			if 'G' not in o:
				answer[shomarande] = 'G'
			elif 'R' not in o:
				answer[shomarande] = 'R'
			else:
				answer[shomarande] = 'B'
		else:
			answer[shomarande] = s[i - 1]
		a = b
	shomarande += 1
if s[n - 1] == answer[shomarande - 1]:
	if answer[shomarande - 1] != 'B':
		answer[shomarande] = 'B'
	else:
		answer[shomarande] = 'G'
else:
	answer[shomarande] = s[n - 1]
print(b)
print(''.join(answer))


patten = ['RGB', 'GBR', 'BRG', 'RBG', 'BGR', 'GRB']
recolor_nums = [0, 0, 0, 0, 0, 0]
res = [[], [], [], [], [], []]
p = 0
i = 0
l = input()
l = int(l)
s = input()
while i < l:
	for j in range(6):
		if s[i] != patten[j][p]:
			recolor_nums[j] += 1
		res[j].append(patten[j][p])
	i += 1
	p += 1
	if p > 2:
		p = 0
m = min(recolor_nums)
index = recolor_nums.index(m)
print(m)
print(''.join(res[index]))


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict, deque, Counter, OrderedDict
import threading
from heapq import *

def main():
	n = int(input())
	s = input()
	val = 0
	ans = [s[0]]
	for i in range(1, n):
		if s[i] == ans[i - 1]:
			val += 1
			if i != n - 1:
				for x in ['R', 'G', 'B']:
					if x not in [s[i + 1], ans[i - 1]]:
						ans.append(x)
						break
			else:
				for x in ['R', 'G', 'B']:
					if x != ans[i - 1]:
						ans.append(x)
						break
		else:
			ans.append(s[i])
	print(val)
	print(''.join(ans))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
s = [*input(), 0]
m = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		s[i] = (set('GRB') - set(s[i:i + 2])).pop()
		m += 1
print(m)
print(''.join(s[:-1]))


def check(x, y, z):
	l = ['R', 'B', 'G']
	l.remove(x)
	if x == z:
		return l[0]
	else:
		l.remove(z)
		return l[0]
n = int(input())
l = list(input())
c = 0
i = 0
while i < n - 1:
	if l[i] == l[i + 1]:
		if i + 1 == n - 1:
			x = check(l[i - 1], l[i], l[i + 1])
			l[i] = x
			c = c + 1
		else:
			x = check(l[i], l[i + 1], l[i + 2])
			l[i + 1] = x
			c = c + 1
		i = i + 2
	else:
		i = i + 1
print(c)
s = ''
for i in range(n):
	s = s + l[i]
print(s)


n = int(input())
s = input()
a = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
b = []
for i in range(6):
	ans = 0
	for j in range(n):
		if s[j] != a[i][j % 3]:
			ans += 1
	b.append(ans)
final = a[b.index(min(b))]
print(min(b))
print(final * (n // 3) + final[:n % 3])


n = int(input())
s = list(input())
k = 0
d = {('B', 'R'): 'G', ('B', 'B'): 'G', ('R', 'B'): 'G', ('G', 'R'): 'B', ('R', 'R'): 'B', ('R', 'G'): 'B', ('G', 'B'): 'R', ('B', 'G'): 'R', ('G', 'G'): 'R'}
for i in range(1, n - 1):
	if s[i] == s[i - 1]:
		k += 1
		s[i] = d[s[i - 1], s[i + 1]]
if n >= 2 and s[-1] == s[-2]:
	k += 1
	s[-1] = 'R' if s[-2] != 'R' else 'G'
print(k)
print(''.join(s))


import sys
n = int(input())
lamps = input()
if len(lamps) == 1:
	print(0)
	print(lamps)
	sys.exit(0)

def other(c1, c2='R'):
	if 'G' != c1 and 'G' != c2:
		return 'G'
	elif 'R' != c1 and 'R' != c2:
		return 'R'
	else:
		return 'B'
newlamps = list(lamps)
i = 1
recolors = 0
while i < n - 1:
	if newlamps[i] == newlamps[i - 1]:
		recolors += 1
		newlamps[i] = other(newlamps[i - 1], newlamps[i + 1])
	i += 1
if newlamps[-1] == newlamps[-2]:
	newlamps[-1] = other(newlamps[-2])
	recolors += 1
print(recolors)
print(''.join(newlamps))


n = int(input())
s = str(input())
arr = []
for i in range(len(s)):
	arr.append(s[i])
i = 0
ans = 0
while i < n - 1:
	if arr[i] == arr[i + 1]:
		if i < n - 2 and arr[i + 1] == arr[i + 2]:
			if arr[i] == 'R':
				arr[i + 1] = 'B'
			elif arr[i] == 'B':
				arr[i + 1] = 'R'
			else:
				arr[i + 1] = 'R'
			i += 2
			ans += 1
		elif i < n - 2:
			if arr[i] == 'R' and arr[i + 2] == 'G':
				arr[i + 1] = 'B'
			elif arr[i] == 'R' and arr[i + 2] == 'B':
				arr[i + 1] = 'G'
			elif arr[i] == 'B' and arr[i + 2] == 'G':
				arr[i + 1] = 'R'
			elif arr[i] == 'B' and arr[i + 2] == 'R':
				arr[i + 1] = 'G'
			elif arr[i] == 'G' and arr[i + 2] == 'R':
				arr[i + 1] = 'B'
			elif arr[i] == 'G' and arr[i + 2] == 'B':
				arr[i + 1] = 'R'
			i += 2
			ans += 1
		else:
			if arr[i] == 'R':
				arr[i + 1] = 'B'
			elif arr[i] == 'B':
				arr[i + 1] = 'G'
			elif arr[i] == 'G':
				arr[i + 1] = 'R'
			ans += 1
	else:
		i += 1
print(ans)
print(''.join((str(x) for x in arr)))


def color(a, b):
	if a == 'R' and b == 'G':
		return 'B'
	elif a == 'R' and b == 'B':
		return 'G'
	elif a == 'R' and b == 'R':
		return 'B'
	if a == 'B' and b == 'G':
		return 'R'
	elif a == 'B' and b == 'R':
		return 'G'
	elif a == 'B' and b == 'B':
		return 'R'
	if a == 'G' and b == 'G':
		return 'R'
	elif a == 'G' and b == 'R':
		return 'B'
	elif a == 'G' and b == 'B':
		return 'R'
n = int(input())
s = input()
ans = str(s[0])
count = 0
for i in range(1, n - 1):
	if ans[-1] == s[i]:
		ans += color(ans[-1], s[i + 1])
		count += 1
	else:
		ans += s[i]
if len(ans) != len(s):
	if ans[-1] != s[-1]:
		ans += s[-1]
	else:
		ans += color(ans[-1], s[-1])
		count += 1
print(count)
print(ans)


def creatMap(s):
	mp = {}
	for i in k:
		mp[i] = 0
	mp['#'] = 0
	return mp
n = int(input())
s = list(input())
s.append('#')
k = 'BGR'
res = 0
for i in range(0, n - 1):
	if s[i] == s[i + 1]:
		res += 1
		mp = creatMap(s)
		mp[s[i]] += 1
		mp[s[i + 2]] += 1
		for c in k:
			if mp[c] == 0:
				s[i + 1] = c
print(f"{res}\n{''.join(s[:n])}")


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	s = list(inp())
	cnt = 0
	for i in range(1, n):
		if s[i] == s[i - 1]:
			cnt += 1
			if i == n - 1:
				if s[i] == 'B':
					s[i] = 'G'
					continue
				if s[i] == 'G':
					s[i] = 'B'
					continue
				if s[i] == 'R':
					s[i] = 'B'
					continue
			if s[i] == 'R':
				if s[i + 1] == 'R':
					s[i] = 'G'
				if s[i + 1] == 'G':
					s[i] = 'B'
				if s[i + 1] == 'B':
					s[i] = 'G'
				continue
			if s[i] == 'B':
				if s[i + 1] == 'R':
					s[i] = 'G'
				if s[i + 1] == 'G':
					s[i] = 'R'
				if s[i + 1] == 'B':
					s[i] = 'G'
				continue
			if s[i] == 'G':
				if s[i + 1] == 'R':
					s[i] = 'B'
				if s[i + 1] == 'G':
					s[i] = 'B'
				if s[i + 1] == 'B':
					s[i] = 'R'
				continue
	print(cnt)
	print(''.join(s))
testcase(1)


l = int(input())
g = input()
n = {'rgb': 0, 'rbg': 0, 'gbr': 0, 'grb': 0, 'brg': 0, 'bgr': 0}
f = False
for k in range(l):
	if k % 3 == 0 and g[k] != 'R':
		n['rgb'] += 1
	elif k % 3 == 1 and g[k] != 'G':
		n['rgb'] += 1
	elif k % 3 == 2 and g[k] != 'B':
		n['rgb'] += 1
min = n['rgb']
for k in range(l):
	if n['rbg'] >= min:
		f = True
		break
	if k % 3 == 0 and g[k] != 'R':
		n['rbg'] += 1
	elif k % 3 == 1 and g[k] != 'B':
		n['rbg'] += 1
	elif k % 3 == 2 and g[k] != 'G':
		n['rbg'] += 1
if f == False:
	min = n['rbg']
f = False
for k in range(l):
	if n['gbr'] >= min:
		f = True
		break
	if k % 3 == 0 and g[k] != 'G':
		n['gbr'] += 1
	elif k % 3 == 1 and g[k] != 'B':
		n['gbr'] += 1
	elif k % 3 == 2 and g[k] != 'R':
		n['gbr'] += 1
if f == False:
	min = n['gbr']
f = False
for k in range(l):
	if n['grb'] >= min:
		f = True
		break
	if k % 3 == 0 and g[k] != 'G':
		n['grb'] += 1
	elif k % 3 == 1 and g[k] != 'R':
		n['grb'] += 1
	elif k % 3 == 2 and g[k] != 'B':
		n['grb'] += 1
if f == False:
	min = n['grb']
f = False
for k in range(l):
	if n['brg'] >= min:
		f = True
		break
	if k % 3 == 0 and g[k] != 'B':
		n['brg'] += 1
	elif k % 3 == 1 and g[k] != 'R':
		n['brg'] += 1
	elif k % 3 == 2 and g[k] != 'G':
		n['brg'] += 1
if f == False:
	min = n['brg']
f = False
for k in range(l):
	if n['bgr'] >= min:
		break
	if k % 3 == 0 and g[k] != 'B':
		n['bgr'] += 1
	elif k % 3 == 1 and g[k] != 'G':
		n['bgr'] += 1
	elif k % 3 == 2 and g[k] != 'R':
		n['bgr'] += 1
sort = sorted(n.items(), key=lambda kv: kv[1])
need = sort[0][0]
f = sort[0][1]
s = ''
s += need * (l // 3)
if l % 3 == 1:
	s += need[0]
if l % 3 == 2:
	s += need[0]
	s += need[1]
print(f)
print(s.upper())


n = int(input())
s = input()
possible = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
costs = []
for i in possible:
	cost = 0
	temp = i * (len(s) // 3) + i[:len(s) % 3]
	for _ in range(len(s)):
		if not s[_] == temp[_]:
			cost += 1
	costs.append(cost)
m = min(costs)
print(m)
k = costs.index(m)
print(possible[k] * (len(s) // 3) + possible[k][:len(s) % 3])


n = int(input())
s = input()
l = 9999999999999
a = ['RBG', 'RGB', 'BGR', 'BRG', 'GRB', 'GBR']
b = []
x = -1
y = 0
for i in range(0, 6):
	m = ''
	q = a[i]
	p = 0
	r = 0
	for j in range(0, n):
		r = j
		r = r % 3
		if s[j] != a[i][r]:
			p += 1
			m = m + a[i][r]
		else:
			m = m + s[j]
	if p == 0:
		y += 1
		break
	if l > p:
		l = p
		x = i
	b.append(m)
if y > 0:
	print('0')
	print(s)
else:
	print(l)
	print(b[x])


def conflict(s, i, f, b, c):
	if b == 0:
		if f == 0:
			return 0
		if f == 1:
			return int(c == s[i + 1])
	if b == 1:
		if f == 0:
			return int(c == s[i - 1])
		if f == 1:
			return int(c == s[i - 1]) + int(c == s[i + 1])

def main():
	n = int(input())
	s = [c for c in input()]
	(counter, prev_conf) = (0, 0)
	for i in range(0, n):
		b = 0 if i == 0 else 1
		f = 0 if i == n - 1 else 1
		conf = conflict(s, i, f, b, s[i])
		l = ['R', 'G', 'B']
		if conf == 0 and prev_conf == 0:
			continue
		elif prev_conf == 1 and (conf == 0 or s[i] != s[i - 1]):
			l.remove(s[i])
			l.remove(s[i - 1])
			s[i - 1] = l[0]
			counter += 1
			prev_conf = 0
		elif conf == 1 and i != n - 1:
			prev_conf = 1
		else:
			l.remove(s[i])
			s[i] = l[0]
			counter += 1
			prev_conf = 0
	print(str(counter) + '\n' + ''.join(s))
main()


n = int(input())
s = str(input())
ch = [False for x in range(n + 1)]
colors = 'RGB'
c = 0
ans = 0
while c < n:
	if c + 1 < n and s[c] == s[c + 1]:
		ch[c + 1] = True
		c += 1
		ans += 1
	c += 1
print(ans)
for i in range(n):
	if ch[i] == False:
		print(s[i], end='')
	else:
		tmp = 0
		while colors[tmp] == s[i - 1] or (i != n - 1 and colors[tmp] == s[i + 1]):
			tmp += 1
			tmp %= 3
		print(colors[tmp], end='')


n = int(input())
c = input()
d = {}
d[0] = 'B'
d[1] = 'G'
d[2] = 'R'
a = []
ct = 0
for k in range(n):
	if c[k] == 'B':
		a.append(0)
	elif c[k] == 'G':
		a.append(1)
	else:
		a.append(2)
for k in range(1, n - 1):
	if a[k] == a[k - 1]:
		ct += 1
		if a[k - 1] == a[k + 1]:
			a[k] = int(a[k] + 1) % 3
		else:
			a[k] = 3 - a[k - 1] - a[k + 1]
if a[n - 1] == a[n - 2] and n > 1:
	ct += 1
	a[n - 1] = int(a[n - 1] + 1) % 3
b = ''
for k in range(n):
	b += d[a[k]]
print(ct)
print(b)


n = int(input())
m = [*input()]
a = [] + m
A = 0
b = [] + m
B = 0
c = [] + m
C = 0
d = [] + m
D = 0
e = [] + m
E = 0
f = [] + m
F = 0
for i in range(n):
	if i % 3 == 0:
		(a[i], b[i], c[i], d[i], e[i], f[i]) = ('R', 'R', 'G', 'G', 'B', 'B')
		if m[i] == 'R':
			C += 1
			D += 1
			E += 1
			F += 1
		elif m[i] == 'G':
			A += 1
			B += 1
			E += 1
			F += 1
		else:
			A += 1
			B += 1
			C += 1
			D += 1
	elif i % 3 == 1:
		(a[i], b[i], c[i], d[i], e[i], f[i]) = ('G', 'B', 'R', 'B', 'R', 'G')
		if m[i] == 'R':
			A += 1
			B += 1
			D += 1
			F += 1
		elif m[i] == 'G':
			B += 1
			C += 1
			D += 1
			E += 1
		else:
			A += 1
			C += 1
			E += 1
			F += 1
	else:
		(a[i], b[i], c[i], d[i], e[i], f[i]) = ('B', 'G', 'B', 'R', 'G', 'R')
		if m[i] == 'R':
			A += 1
			B += 1
			C += 1
			E += 1
		elif m[i] == 'G':
			A += 1
			C += 1
			D += 1
			F += 1
		else:
			B += 1
			D += 1
			E += 1
			F += 1
Min = min(A, B, C, D, E, F)
if A == Min:
	print(A)
	print(''.join(a))
elif B == Min:
	print(B)
	print(''.join(b))
elif C == Min:
	print(C)
	print(''.join(c))
elif D == Min:
	print(D)
	print(''.join(d))
elif E == Min:
	print(E)
	print(''.join(e))
else:
	print(F)
	print(''.join(f))


n = int(input())
a = input()
if n == 1:
	print(0)
	print(a)
	exit()
posl = [list('RGB'), list('RBG'), list('BRG'), list('BGR'), list('GBR'), list('GRB')]
m = 0
se = 0
kak = 0
for j in range(6):
	se = 0
	for i in range(n):
		if a[i] == posl[j][i % 3]:
			se += 1
	if se > m:
		m = se
		kak = j
print(n - m)
for i in range(n):
	print(posl[kak][i % 3], end='')
print()


n = int(input())
s = input()
count = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for i in range(n):
	if i % 3 == 0:
		if s[i] == 'B':
			count[0][2] += 1
		elif s[i] == 'R':
			count[0][0] += 1
		elif s[i] == 'G':
			count[0][1] += 1
	elif i % 3 == 1:
		if s[i] == 'B':
			count[1][2] += 1
		elif s[i] == 'R':
			count[1][0] += 1
		elif s[i] == 'G':
			count[1][1] += 1
	elif s[i] == 'B':
		count[2][2] += 1
	elif s[i] == 'R':
		count[2][0] += 1
	elif s[i] == 'G':
		count[2][1] += 1
maxcount = 0
if count[0][0] + count[1][1] + count[2][2] >= maxcount:
	ans = 'RGB'
	maxcount = count[0][0] + count[1][1] + count[2][2]
if count[0][0] + count[1][2] + count[2][1] >= maxcount:
	ans = 'RBG'
	maxcount = count[0][0] + count[1][2] + count[2][1]
if count[0][1] + count[1][0] + count[2][2] >= maxcount:
	ans = 'GRB'
	maxcount = count[0][1] + count[1][0] + count[2][2]
if count[0][1] + count[1][2] + count[2][0] >= maxcount:
	ans = 'GBR'
	maxcount = count[0][1] + count[1][2] + count[2][0]
if count[0][2] + count[1][0] + count[2][1] >= maxcount:
	ans = 'BRG'
	maxcount = count[0][2] + count[1][0] + count[2][1]
if count[0][2] + count[1][1] + count[2][0] >= maxcount:
	ans = 'BGR'
	maxcount = count[0][2] + count[1][1] + count[2][0]
string = ''
for i in range(n):
	if i % 3 == 0:
		string += str(ans[0])
	elif i % 3 == 1:
		string += str(ans[1])
	else:
		string += str(ans[2])
anscount = n - maxcount
print(anscount)
print(string)


n = int(input())
s1 = [c for c in input()]
d = 0
T = 'RGB'
for i in range(1, len(s1) - 1):
	if s1[i] == s1[i - 1] and s1[i] == s1[i + 1]:
		for c in T:
			if c != s1[i - 1]:
				d += 1
				s1[i] = c
				break
	elif s1[i] == s1[i - 1]:
		for c in T:
			if c != s1[i - 1] and c != s1[i + 1]:
				d += 1
				s1[i] = c
				break
	else:
		pass
if len(s1) > 1 and s1[len(s1) - 2] == s1[len(s1) - 1]:
	for c in T:
		if c != s1[len(s1) - 2]:
			d += 1
			s1[len(s1) - 1] = c
			break
print(d)
print(''.join(s1))


n = int(input())
s = input()
vars = ['RGB', 'RBG', 'GBR', 'GRB', 'BGR', 'BRG']
ans = s
mx = n
for v in vars:
	t = (v * ((n + 2) // 3))[:n]
	cs = 0
	for i in range(n):
		if t[i] != s[i]:
			cs += 1
	if cs < mx:
		mx = cs
		ans = t
print(mx)
print(ans)


n = int(input())
g = list(input())
d = {'R': 0, 'G': 1, 'B': 2}
if n > 1:
	cnt = 0
	for i in range(1, n - 1):
		if g[i] == g[i - 1]:
			cnt += 1
			v = [False] * 3
			for j in range(i - 1, i + 2):
				v[d[g[j]]] = True
			for j in range(3):
				if not v[j]:
					break
			for x in d.keys():
				if d[x] == j:
					g[i] = x
					break
	if g[n - 1] == g[n - 2]:
		v = [False] * 3
		cnt += 1
		v[d[g[n - 1]]] = True
		for j in range(3):
			if not v[j]:
				break
		for x in d.keys():
			if d[x] == j:
				g[n - 1] = x
				break
	print(cnt)
	print(''.join(g))
else:
	print('0')
	print(''.join(g))


set_colors = set(['R', 'G', 'B'])

def diff(*args):
	diff = set_colors - set(args)
	return diff.pop()
length = int(input())
word = list(input())
index = [0, 1, 2]
colors = ['R', 'G', 'B']
new_word = word
flips = 0
for (ix, c) in enumerate(word):
	if ix == 0:
		pass
	elif ix == length - 1:
		prev = word[ix - 1]
		curr = word[ix]
		if curr == prev:
			flips += 1
			new_word[ix] = diff(prev)
	else:
		prev = word[ix - 1]
		curr = word[ix]
		nex = word[ix + 1]
		if curr == prev:
			flips += 1
			new_word[ix] = diff(prev, nex)
print(flips)
print(''.join(new_word))


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	s = input()
	ct = 1 << 31
	odd = 'RGB'
	ans = 0

	def solve(t):
		ans = 0
		i = 0
		for x in s:
			if t[i % 3] != x:
				ans += 1
			i += 1
		nonlocal ct, odd
		if ct > ans:
			ct = ans
			odd = t
		return ans
	ans = min(ans, solve('RGB'))
	ans = min(ans, solve('RBG'))
	ans = min(ans, solve('GRB'))
	ans = min(ans, solve('GBR'))
	ans = min(ans, solve('BRG'))
	ans = min(ans, solve('BGR'))
	print(ct)
	print(''.join((odd[i % 3] for i in range(n))))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin
input = stdin.readline
(n, l, i) = (int(input()), 0, 0)
a = list(input())
b = {'R': ['G', 'B'], 'G': ['R', 'B'], 'B': ['R', 'G']}
dp = [0] * n
while i < n - 2:
	(p, q) = (a[i], a[i + 1])
	if p != q:
		dp[i] = a[i]
		i += 1
		continue
	if p == q:
		dp[i] = a[i]
		l += 1
		c = b[q]
		t = a[i + 2]
		for j in c:
			if t != j:
				dp[i + 1] = j
				break
		i += 2
if i == n - 1:
	dp[n - 1] = a[n - 1]
	print(l)
	print(''.join(dp))
else:
	if a[n - 2] != a[n - 1]:
		(dp[n - 1], dp[n - 2]) = (a[n - 1], a[n - 2])
	else:
		dp[n - 2] = a[n - 2]
		l += 1
		dp[n - 1] = b[a[n - 2]][0]
	print(l)
	print(''.join(dp))


from sys import stdin, stdout
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
N = 10 ** 6 + 7
cng = lambda a: 'R' if 'R' not in a else 'G' if 'G' not in a else 'B'
n = I()
a = list(S()) + ['1']
ans = 0
for i in range(1, n):
	if a[i] == a[i - 1]:
		ans += 1
		a[i] = cng([a[i - 1], a[i + 1]])
print(ans)
print(*a[:-1], sep='')


n = int(input())
s = input()
(s1, s2, s3, s4, s5, s6) = ('', '', '', '', '', '')
for i in range(n):
	if i % 3 == 0:
		s1 += 'R'
		s2 += 'R'
		s3 += 'G'
		s4 += 'G'
		s5 += 'B'
		s6 += 'B'
	elif i % 3 == 1:
		s1 += 'G'
		s2 += 'B'
		s3 += 'R'
		s4 += 'B'
		s5 += 'R'
		s6 += 'G'
	elif i % 3 == 2:
		s1 += 'B'
		s2 += 'G'
		s3 += 'B'
		s4 += 'R'
		s5 += 'G'
		s6 += 'R'
(k1, k2, k3, k4, k5, k6) = (0, 0, 0, 0, 0, 0)
for i in range(n):
	if s[i] == s1[i]:
		k1 += 1
	if s[i] == s2[i]:
		k2 += 1
	if s[i] == s3[i]:
		k3 += 1
	if s[i] == s4[i]:
		k4 += 1
	if s[i] == s5[i]:
		k5 += 1
	if s[i] == s6[i]:
		k6 += 1
l = [(k1, s1), (k2, s2), (k3, s3), (k4, s4), (k5, s5), (k6, s6)]
l.sort(key=lambda x: x[0])
print(n - l[-1][0])
print(l[-1][1])


n = int(input())
s = input()
x = ['RGB', 'RBG', 'GRB', 'GBR', 'BGR', 'BRG']
ans = n
anss = ''
for base in x:
	tempans = 0
	for i in range(n):
		if s[i] != base[i % 3]:
			tempans += 1
	if tempans < ans:
		ans = tempans
		anss = base
print(ans)
d = ''
for i in range(n):
	d += anss[i % 3]
print(d)


n = int(input())
s = [i for i in input()]
if n == 1:
	print(0)
	print(''.join(s))
	quit()
pre = s[0]
c = 0
for i in range(1, n - 1):
	if s[i] == pre:
		if s[i] == 'R' and s[i + 1] == 'B':
			s[i] = 'G'
			pre = 'G'
		elif s[i] == 'R' and s[i + 1] == 'G':
			s[i] = 'B'
			pre = 'B'
		elif s[i] == 'G' and s[i + 1] == 'B':
			s[i] = 'R'
			pre = 'R'
		elif s[i] == 'G' and s[i + 1] == 'R':
			s[i] = 'B'
			pre = 'B'
		elif s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'R'
			pre = 'R'
		elif s[i] == 'B' and s[i + 1] == 'R':
			s[i] = 'G'
			pre = 'G'
		elif s[i] == 'R' and s[i + 1] == 'R':
			s[i] = 'B'
			pre = 'B'
		elif s[i] == 'B' and s[i + 1] == 'B':
			s[i] = 'R'
			pre = 'R'
		elif s[i] == 'G' and s[i + 1] == 'G':
			s[i] = 'B'
			pre = 'B'
		c += 1
	else:
		pre = s[i]
if s[n - 1] == pre:
	c += 1
	if s[n - 1] == 'R':
		s[n - 1] = 'B'
	elif s[n - 1] == 'B':
		s[n - 1] = 'R'
	elif s[n - 1] == 'G':
		s[n - 1] = 'R'
print(c)
print(''.join(s))


from fractions import gcd
from itertools import combinations, permutations, accumulate, product
from collections import deque, defaultdict, Counter
import decimal
import re
import math
import bisect
import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7
from sys import stdin
readline = stdin.readline

def readInts():
	return list(map(int, readline().split()))

def readTuples():
	return tuple(map(int, readline().split()))

def I():
	return int(readline())
n = I()
s = input()
ans = float('inf')
cnt = 0
copy = list(s)
anS = list(s)
(r, g, b) = (0, 1, 2)
while r < n:
	if s[r] != 'R':
		cnt += 1
		copy[r] = 'R'
	r += 3
while g < n:
	if s[g] != 'G':
		cnt += 1
		copy[g] = 'G'
	g += 3
while b < n:
	if s[b] != 'B':
		cnt += 1
		copy[b] = 'B'
	b += 3
if ans > cnt:
	anS = copy
	ans = min(ans, cnt)
cnt = 0
copy = list(s)
(r, g, b) = (0, 2, 1)
while r < n:
	if s[r] != 'R':
		cnt += 1
		copy[r] = 'R'
	r += 3
while g < n:
	if s[g] != 'G':
		cnt += 1
		copy[g] = 'G'
	g += 3
while b < n:
	if s[b] != 'B':
		cnt += 1
		copy[b] = 'B'
	b += 3
if ans > cnt:
	anS = copy
	ans = min(ans, cnt)
cnt = 0
copy = list(s)
(r, g, b) = (1, 0, 2)
while r < n:
	if s[r] != 'R':
		cnt += 1
		copy[r] = 'R'
	r += 3
while g < n:
	if s[g] != 'G':
		cnt += 1
		copy[g] = 'G'
	g += 3
while b < n:
	if s[b] != 'B':
		cnt += 1
		copy[b] = 'B'
	b += 3
if ans > cnt:
	anS = copy
	ans = min(ans, cnt)
cnt = 0
copy = list(s)
(r, g, b) = (1, 2, 0)
while r < n:
	if s[r] != 'R':
		cnt += 1
		copy[r] = 'R'
	r += 3
while g < n:
	if s[g] != 'G':
		cnt += 1
		copy[g] = 'G'
	g += 3
while b < n:
	if s[b] != 'B':
		cnt += 1
		copy[b] = 'B'
	b += 3
if ans > cnt:
	anS = copy
	ans = min(ans, cnt)
cnt = 0
copy = list(s)
(r, g, b) = (2, 0, 1)
while r < n:
	if s[r] != 'R':
		cnt += 1
		copy[r] = 'R'
	r += 3
while g < n:
	if s[g] != 'G':
		cnt += 1
		copy[g] = 'G'
	g += 3
while b < n:
	if s[b] != 'B':
		cnt += 1
		copy[b] = 'B'
	b += 3
if ans > cnt:
	anS = copy
	ans = min(ans, cnt)
cnt = 0
copy = list(s)
(r, g, b) = (2, 1, 0)
while r < n:
	if s[r] != 'R':
		cnt += 1
		copy[r] = 'R'
	r += 3
while g < n:
	if s[g] != 'G':
		cnt += 1
		copy[g] = 'G'
	g += 3
while b < n:
	if s[b] != 'B':
		cnt += 1
		copy[b] = 'B'
	b += 3
if ans > cnt:
	anS = copy
	ans = min(ans, cnt)
print(ans)
print(*anS, sep='')


n = int(input())
str = input()
(diff, remod) = (0, str[0])
for i in range(1, n):
	prev = remod[i - 1]
	if prev == str[i]:
		opt = ['R', 'G', 'B']
		opt.remove(str[i])
		if i >= n - 1:
			remod += opt[0]
		else:
			if str[i + 1] in opt:
				opt.remove(str[i + 1])
			remod += opt[0]
		diff += 1
	else:
		remod += str[i]
print(diff, remod)


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return len(set(factors))

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))
MOD = 1000000007
T = 1
for _ in range(T):
	q = int(input())
	s = input()
	val = q
	for t in ('RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR'):
		temp = 0
		for i in range(q):
			if s[i] != t[i % 3]:
				temp += 1
		if val >= temp:
			val = temp
			ans = t * (q // 3) + t[:q % 3]
	print(val)
	print(ans)


n = eval(input())
lamps = input()
permutations = ['RGB', 'RBG', 'BGR', 'BRG', 'GRB', 'GBR']
minimum = n
pattern = ''
for i in permutations:
	count = 0
	for j in range(len(lamps)):
		if j % 3 == 0 and lamps[j] != i[0]:
			count += 1
		elif j % 3 == 1 and lamps[j] != i[1]:
			count += 1
		elif j % 3 == 2 and lamps[j] != i[2]:
			count += 1
	if count < minimum:
		pattern = i
		minimum = count
answer = ''
for i in range(n):
	answer += pattern[i % 3]
print(minimum)
print(answer)


import sys
from bisect import bisect_left, bisect_right
from collections import deque, Counter
from math import gcd, sqrt, factorial, ceil, log
from itertools import permutations
inf = float('inf')
mod = 1000000007
mini = 1000000007

def fact(n):
	if n == 0:
		return 1
	p = 1
	d = 10 ** 9 + 7
	for i in range(1, n + 1):
		p = p * i
		p = p % d
	return p

def ncr(n, r):
	d = 10 ** 9 + 7
	num = fact(n)
	den = fact(r) * fact(n - r) % d
	den = pow(den, d - 2, d)
	return num * den % d

def sieve(n):
	prime = [True for i in range(n + 1)]
	lst = [0] * (n + 1)
	p = 2
	while p * p <= n:
		if prime[p]:
			lst[p] = p
			for i in range(p * p, n + 1, p):
				if prime[i] == True:
					prime[i] = False
					lst[i] = p
		p = p + 1
	for i in range(1, n + 1):
		if lst[i] == 0:
			lst[i] = i
	mylist = [0] * (n + 1)
	for i in range(2, n + 1):
		mylist[lst[i]] = mylist[lst[i]] + 1
	return mylist

def binary(number):
	result = 0
	while number:
		result = result + 1
		number = number & number - 1
	return result

def calculate_factors(n):
	hh = [1] * (n + 1)
	p = 2
	while p * p < n:
		if hh[p] == 1:
			for i in range(p * 2, n, p):
				hh[i] = 0
		p += 1
	total = 1
	for p in range(2, n + 1):
		if hh[p] == 1:
			count = 0
			if n % p == 0:
				while n % p == 0:
					n = int(n / p)
					count += 1
				total *= count + 1
	return total

def prime_factors(n):
	i = 2
	factors = set()
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.add(i)
	if n > 1:
		factors.add(n)
	if len(factors) == 2:
		return True
	else:
		return False

def isPrime(n):
	if n == 2 or n == 3:
		return True
	if n % 2 == 0 or n < 2:
		return False
	for i in range(3, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
string = input()
s1 = ['R', 'G', 'B']
s2 = ['R', 'B', 'G']
s3 = ['B', 'G', 'R']
s4 = ['B', 'R', 'G']
s5 = ['G', 'B', 'R']
s6 = ['G', 'R', 'B']
str1 = []
str2 = []
str3 = []
str4 = []
str5 = []
str6 = []
for i in range(n):
	str1.append(s1[i % 3])
	str2.append(s2[i % 3])
	str3.append(s3[i % 3])
	str4.append(s4[i % 3])
	str5.append(s5[i % 3])
	str6.append(s6[i % 3])
(c1, c2, c3, c4, c5, c6) = (0, 0, 0, 0, 0, 0)
for i in range(n):
	if string[i] != str1[i]:
		c1 = c1 + 1
	if string[i] != str2[i]:
		c2 = c2 + 1
	if string[i] != str3[i]:
		c3 = c3 + 1
	if string[i] != str4[i]:
		c4 = c4 + 1
	if string[i] != str5[i]:
		c5 = c5 + 1
	if string[i] != str6[i]:
		c6 = c6 + 1
minimum = min(c1, c2, c3, c4, c5, c6)
print(minimum)
if c1 == minimum:
	print(''.join(str1))
elif c2 == minimum:
	print(''.join(str2))
elif c3 == minimum:
	print(''.join(str3))
elif c4 == minimum:
	print(''.join(str4))
elif c5 == minimum:
	print(''.join(str5))
else:
	print(''.join(str6))


(n, ls) = (int(input()), list(input()))
opts = set('RGB')
minc = n
for fst in opts:
	for snd in opts:
		if snd == fst:
			continue
		for trd in opts:
			if trd == fst or trd == snd:
				continue
			changes = 0
			curr = 0
			c = [fst, snd, trd]
			for s in ls:
				if c[curr] != s:
					changes += 1
					if changes > minc:
						break
				curr = (curr + 1) % 3
			else:
				minc = changes
				setup = c.copy()
ls2 = []
for _ in range(n):
	ls2.append(setup[_ % 3])
print(minc)
print(''.join(ls2))


n = int(input())
lis = list(input())
lis_R = [0 if lis[0] == 'R' else 1]
lis_G = [0 if lis[0] == 'G' else 1]
lis_B = [0 if lis[0] == 'B' else 1]
from_R = [-1]
from_G = [-1]
from_B = [-1]
for i in range(1, n):
	t1 = lis_G[i - 1] + (0 if lis[i] == 'R' else 1)
	t2 = lis_B[i - 1] + (0 if lis[i] == 'R' else 1)
	if t1 < t2:
		lis_R.append(t1)
		from_R.append(2)
	else:
		lis_R.append(t2)
		from_R.append(3)
	t1 = lis_R[i - 1] + (0 if lis[i] == 'G' else 1)
	t2 = lis_B[i - 1] + (0 if lis[i] == 'G' else 1)
	if t1 < t2:
		lis_G.append(t1)
		from_G.append(1)
	else:
		lis_G.append(t2)
		from_G.append(3)
	t1 = lis_G[i - 1] + (0 if lis[i] == 'B' else 1)
	t2 = lis_R[i - 1] + (0 if lis[i] == 'B' else 1)
	if t1 < t2:
		lis_B.append(t1)
		from_B.append(2)
	else:
		lis_B.append(t2)
		from_B.append(1)
print(min(lis_R[n - 1], lis_G[n - 1], lis_B[n - 1]))
map = {1: from_R, 2: from_G, 3: from_B}
if lis_R[n - 1] <= lis_G[n - 1] and lis_R[n - 1] <= lis_B[n - 1]:
	current = 1
elif lis_G[n - 1] <= lis_R[n - 1] and lis_G[n - 1] <= lis_B[n - 1]:
	current = 2
else:
	current = 3
current_lis = map[current]
k = n - 1
res = [current]
while k > 0:
	current = current_lis[k]
	res.append(current)
	current_lis = map[current]
	k -= 1
res = reversed(res)
for i in res:
	if i == 1:
		print('R', end='')
	elif i == 2:
		print('G', end='')
	else:
		print('B', end='')


n = int(input())
g = input()
s = list(g)
if s[n - 1] == 'G':
	s.append('R')
elif s[n - 1] == 'R':
	s.append('G')
else:
	s.append('G')
if s[0] == 'G':
	s.insert(0, 'R')
elif s[0] == 'R':
	s.insert(0, 'G')
else:
	s.insert(0, 'G')
cnt = 0
for i in range(1, len(s) - 1):
	if s[i] == s[i - 1] and s[i] == s[i + 1]:
		cnt += 1
		if s[i] == 'R':
			s[i] = 'B'
		elif s[i] == 'B':
			s[i] = 'R'
		else:
			s[i] = 'B'
	elif s[i] == s[i - 1]:
		cnt += 1
		if s[i] == 'R':
			if s[i - 2] == 'G':
				s[i - 1] = 'B'
			elif s[i - 2] == 'B':
				s[i - 1] = 'G'
		if s[i] == 'G':
			if s[i - 2] == 'R':
				s[i - 1] = 'B'
			elif s[i - 2] == 'B':
				s[i - 1] = 'R'
		if s[i] == 'B':
			if s[i - 2] == 'R':
				s[i - 1] = 'G'
			elif s[i - 2] == 'G':
				s[i - 1] = 'R'
	elif s[i] == s[i + 1]:
		if s[i] == 'G':
			if s[i + 2] == 'R':
				cnt += 1
				s[i + 1] = 'B'
			elif s[i + 2] == 'B':
				cnt += 1
				s[i + 1] = 'R'
		if s[i] == 'R':
			if s[i + 2] == 'G':
				cnt += 1
				s[i + 1] = 'B'
			elif s[i + 2] == 'B':
				cnt += 1
				s[i + 1] = 'G'
		if s[i] == 'B':
			if s[i + 2] == 'R':
				cnt += 1
				s[i + 1] = 'G'
			elif s[i + 2] == 'G':
				cnt += 1
				s[i + 1] = 'R'
print(cnt)
print(''.join(s[1:len(s) - 1]))


dp = [[10000000] * 3 for _ in range(200005)]
n = int(input())
s = input()
dp[-1] = [0, 0, 0]
prev_val = [[0] * 3 for _ in range(200005)]
for (i, c) in enumerate(s):
	curr = 'RGB'.index(c)
	for x in range(2 + 1):
		if curr != x and dp[i][curr] > dp[i - 1][x]:
			dp[i][curr] = dp[i - 1][x]
			prev_val[i][curr] = x
	for x in range(2 + 1):
		if curr != x:
			for z in range(2 + 1):
				if z != x and dp[i][x] > dp[i - 1][z] + 1:
					dp[i][x] = dp[i - 1][z] + 1
					prev_val[i][x] = z
curr_idx = dp[n - 1].index(min(dp[n - 1]))
print(min(dp[n - 1]))
ans = []
for i in reversed(range(n)):
	ans.append('RGB'[curr_idx])
	curr_idx = prev_val[i][curr_idx]
print(''.join(reversed(ans)))


n = int(input())
s = list(input())
minn = 0
if n != 1:
	for i in range(n - 2):
		if s[i] == s[i + 1] == s[i + 2]:
			if s[i] == 'R':
				s[i + 1] = 'G'
			elif s[i] == 'G':
				s[i + 1] = 'B'
			else:
				s[i + 1] = 'R'
			minn += 1
		elif s[i] == s[i + 1]:
			if s[i] == 'R' and s[i + 2] == 'G':
				s[i + 1] = 'B'
			elif s[i] == 'R' and s[i + 2] == 'B':
				s[i + 1] = 'G'
			elif s[i] == 'G' and s[i + 2] == 'B':
				s[i + 1] = 'R'
			elif s[i] == 'G' and s[i + 2] == 'R':
				s[i + 1] = 'B'
			elif s[i] == 'B' and s[i + 2] == 'R':
				s[i + 1] = 'G'
			else:
				s[i + 1] = 'R'
			minn += 1
	if s[n - 2] == s[n - 1]:
		if s[n - 2] == 'R':
			s[n - 1] = 'G'
		elif s[n - 2] == 'G':
			s[n - 1] = 'B'
		else:
			s[n - 1] = 'R'
		minn += 1
	print(minn)
	for i in range(n):
		print(s[i], end='')
else:
	print(0)
	print(s[0])


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)


def diff(s1, s):
	cnt = 0
	for c in range(len(s)):
		if s[c] == s1[c]:
			pass
		else:
			cnt += 1
	return cnt
a = ['RGB', 'RBG', 'BGR', 'BRG', 'GBR', 'GRB']
n = int(input())
s = input()
min = 1000000000
for i in range(len(a)):
	s1 = a[i] * (n // 3) + a[i][:n % 3]
	if diff(s1, s) < min:
		min = diff(s1, s)
		sk = str(s1)
if min == 0:
	print(0)
	print(s)
else:
	print(min)
	print(sk)


from sys import stdin

def change_forward(arr, n, aux):
	cost = 0
	i = 0
	while i < n:
		if arr[i] != aux[0]:
			cost += 1
		if i + 1 < n:
			if arr[i + 1] != aux[1]:
				cost += 1
		else:
			break
		if i + 2 < n:
			if arr[i + 2] != aux[2]:
				cost += 1
		i += 3
	return cost
n = int(stdin.readline().strip())
arr = list(stdin.readline().strip())
permut = [['R', 'G', 'B'], ['R', 'B', 'G'], ['G', 'R', 'B'], ['G', 'B', 'R'], ['B', 'R', 'G'], ['B', 'G', 'R']]
mycost = float('inf')
for i in range(len(permut)):
	cost = change_forward(arr, n, permut[i])
	if cost < mycost:
		mycost = cost
		index = i
print(mycost)
i = 0
while i < n:
	print(permut[index][i % 3], end='')
	i += 1


n = int(input())
s = str(input())
import itertools
(q, r) = divmod(n, 3)
ans = 10 ** 18
t = -1
for p in itertools.permutations(('R', 'G', 'B')):
	temp = 0
	for i in range(n):
		if s[i] != p[i % 3]:
			temp += 1
	if temp <= ans:
		ans = temp
		t = ''.join(p) * q + ''.join(p[0:r])
print(ans)
print(t)


n = int(input())
s = input()
y = len(s)
p = ['BRG', 'BGR', 'GBR', 'GRB', 'RGB', 'RBG']
for i in range(6):
	f = []
	k = 0
	for j in range(len(s)):
		if s[j] == p[i][j % 3]:
			f.append(s[j])
		else:
			k = k + 1
			f.append(p[i][j % 3])
	if k < y:
		g = f
		y = k
print(y)
print(''.join(g))


n = int(input())
t = list(str(input()))
possible = ['R', 'G', 'B']
count = 0
for i in range(len(t) - 2):
	if t[i] == t[i + 1]:
		for j in range(len(possible)):
			if possible[j] != t[i] and possible[j] != t[i + 2]:
				t[i + 1] = possible[j]
				count += 1
				break
if len(t) > 1:
	if t[-1] == t[-2]:
		for j in range(len(possible)):
			if possible[j] != t[-2] and possible[j] != t[-1]:
				t[-1] = possible[j]
				count += 1
				break
print(count)
print(''.join(t))


n = int(input())
m = list(input())
i = 0
k = 0
q = ['R', 'G', 'B']
if n == 1:
	print(0)
	print(*m)
	exit()
if n == 2:
	if m[1] == m[0]:
		print(1)
		if q.index(m[0]) == 1:
			print(m[0] + q[2])
		else:
			print(m[0] + q[1])
	else:
		print(0)
		print(*m, sep='')
	exit()
while i < n - 2:
	if m[i] == m[i + 1] and m[i] == m[i + 2]:
		if q.index(m[i + 2]) == 1:
			m[i + 1] = q[0]
		else:
			m[i + 1] = q[1]
		k += 1
		i += 1
	elif m[i] == m[i + 1]:
		if q.index(m[i - 1]) + q.index(m[i + 1]) == 2:
			m[i] = q[1]
		elif q.index(m[i - 1]) + q.index(m[i + 1]) == 1:
			m[i] = q[2]
		else:
			m[i] = q[0]
		k += 1
	i += 1
if m[-2] == m[-1]:
	if q.index(m[-3]) + q.index(m[-1]) == 2:
		if m[-3] == m[-2]:
			m[-2] = q[2]
		else:
			m[-2] = q[1]
	elif q.index(m[-3]) + q.index(m[-1]) == 1:
		m[-2] = q[2]
	elif q.index(m[-3]) + q.index(m[-1]) == 3:
		m[-2] = q[0]
	else:
		m[-2] = q[1]
	k += 1
print(k)
print(*m, sep='')


import sys
inf = float('inf')

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())
n = int(input().strip())
s = input()
l = list(s)
if n > 1:
	ans = [l[0]]
	for i in range(1, n - 1):
		if l[i] == ans[-1]:
			if l[i] == l[i + 1]:
				if l[i] == 'B':
					ans.append('G')
				elif l[i] == 'G':
					ans.append('B')
				else:
					ans.append('G')
			else:
				if l[i] == 'B' and l[i + 1] == 'G' or (l[i] == 'G' and l[i + 1] == 'B'):
					ans.append('R')
				elif l[i] == 'B' and l[i + 1] == 'R' or (l[i] == 'R' and l[i + 1] == 'B'):
					ans.append('G')
				if l[i] == 'R' and l[i + 1] == 'G' or (l[i] == 'G' and l[i + 1] == 'R'):
					ans.append('B')
		else:
			ans.append(l[i])
	if l[-1] == ans[-1]:
		if ans[-1] == 'G' or ans[-1] == 'R':
			ans.append('B')
		else:
			ans.append('R')
	else:
		ans.append(l[-1])
	one = ans[:]
	l = l[::-1]
	ans = [l[0]]
	for i in range(1, n - 1):
		if l[i] == ans[-1]:
			if l[i] == l[i + 1]:
				if l[i] == 'B':
					ans.append('G')
				elif l[i] == 'G':
					ans.append('B')
				else:
					ans.append('G')
			else:
				if l[i] == 'B' and l[i + 1] == 'G' or (l[i] == 'G' and l[i + 1] == 'B'):
					ans.append('R')
				elif l[i] == 'B' and l[i + 1] == 'R' or (l[i] == 'R' and l[i + 1] == 'B'):
					ans.append('G')
				if l[i] == 'R' and l[i + 1] == 'G' or (l[i] == 'G' and l[i + 1] == 'R'):
					ans.append('B')
		else:
			ans.append(l[i])
	if l[-1] == ans[-1]:
		if ans[-1] == 'G' or ans[-1] == 'R':
			ans.append('B')
		else:
			ans.append('R')
	else:
		ans.append(l[-1])
	c = d = 0
	for i in range(n):
		if one[i] != s[i]:
			c += 1
		if ans[i] != s[i]:
			d += 1
	if c <= d:
		print(c)
		print(''.join(one))
	else:
		print(d)
		print(''.join(ans))
else:
	print(0)
	print(s)


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

def gens(s, m):
	subs = ['RGB', 'RBG', 'GBR', 'GRB', 'BGR', 'BRG']
	d = []
	v = []
	for i in subs:
		c = 0
		l = i * (m // 3)
		l += i[:m % 3]
		v.append(l)
		for j in range(n):
			if l[j] != s[j]:
				c += 1
		d.append(c)
	k = d.index(min(d))
	print(d[k])
	print(v[k])
gens(s, n)


n = int(input())
s = input()
a = 0
l = list(s)
d = {'R': 0, 'G': 2, 'B': 1}
f = {0: 'R', 1: 'B', 2: 'G'}
for x in range(0, len(s) - 1, 2):
	if l[x] == l[x + 1]:
		if x + 2 < n:
			if l[x + 1] == l[x + 2]:
				l[x + 1] = f[(d[l[x]] + 1) % 3]
				a += 1
			elif (d[l[x + 2]] + 1) % 3 != d[l[x]]:
				l[x + 1] = f[(d[l[x + 2]] + 1) % 3]
				a += 1
			else:
				l[x + 1] = f[(d[l[x + 2]] + 2) % 3]
				a += 1
		else:
			l[x + 1] = f[(d[l[x]] + 1) % 3]
			a += 1
	elif x + 2 < n:
		if l[x + 1] == l[x + 2]:
			if x + 3 < n and l[x + 3] == l[x + 2]:
				l[x + 2] = f[(d[l[x + 1]] + 1) % 3]
				a += 1
			elif (d[l[x + 2]] + 1) % 3 != d[l[x]]:
				l[x + 1] = f[(d[l[x + 2]] + 1) % 3]
				a += 1
			else:
				l[x + 1] = f[(d[l[x + 2]] + 2) % 3]
				a += 1
print(a)
print(''.join(l))


n = int(input())
arr = input()
changed = []
result = 0
prevChar = None
for i in range(len(arr)):
	if arr[i] == prevChar:
		rgb = ['R', 'G', 'B']
		for j in range(len(rgb)):
			if rgb[j] == arr[i]:
				rgb.pop(j)
				break
		if i < len(arr) - 1:
			for j in range(len(rgb)):
				if rgb[j] == arr[i + 1]:
					rgb.pop(j)
					break
		changed.append(rgb[0])
		prevChar = rgb[0]
		result += 1
	else:
		changed.append(arr[i])
		prevChar = arr[i]
print(result)
print(''.join(changed))


n = int(input())
s = list(input())
ans = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		if s[i - 1] != 'R' and (i + 1 >= n or s[i + 1] != 'R'):
			s[i] = 'R'
		elif s[i - 1] != 'G' and (i + 1 >= n or s[i + 1] != 'G'):
			s[i] = 'G'
		elif s[i - 1] != 'B' and (i + 1 >= n or s[i + 1] != 'B'):
			s[i] = 'B'
		ans += 1
print(ans)
print(''.join(s))


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions
from collections import deque, defaultdict, OrderedDict
from fractions import Fraction
from decimal import Decimal

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(1):
		n = ri()
		s = rs()
		a = []
		ans = 0
		for i in s:
			if i == 'R':
				a.append(1)
			if i == 'G':
				a.append(2)
			if i == 'B':
				a.append(3)
		for i in range(1, n - 1):
			if a[i] == a[i + 1] and a[i] == a[i - 1]:
				a[i] = a[i] + 1
				if a[i] == 4:
					a[i] = 1
				ans += 1
			if a[i] == a[i - 1]:
				a[i] = 6 - a[i - 1] - a[i + 1]
				ans += 1
		if n > 1:
			if a[n - 1] == a[n - 2]:
				a[n - 1] = a[n - 1] + 1
				if a[n - 1] == 4:
					a[n - 1] = 1
				ans += 1
		s = ''
		print(ans)
		for i in a:
			if i == 1:
				s += 'R'
			if i == 2:
				s += 'G'
			if i == 3:
				s += 'B'
		print(s)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


n = int(input())
(RGB, RBG, GRB, GBR, BRG, BGR) = (n, n, n, n, n, n)
s = input()
for i in range(n):
	if i % 3 == 0:
		if s[i] == 'R':
			RGB -= 1
			RBG -= 1
		elif s[i] == 'G':
			GRB -= 1
			GBR -= 1
		else:
			BRG -= 1
			BGR -= 1
	elif i % 3 == 1:
		if s[i] == 'R':
			GRB -= 1
			BRG -= 1
		elif s[i] == 'G':
			RGB -= 1
			BGR -= 1
		else:
			RBG -= 1
			GBR -= 1
	elif s[i] == 'R':
		GBR -= 1
		BGR -= 1
	elif s[i] == 'G':
		RBG -= 1
		BRG -= 1
	else:
		RGB -= 1
		GRB -= 1
m = min(RBG, RGB, BRG, BGR, GRB, GBR)
print(m)
if m == RBG:
	print('RBG' * (n // 3) + 'RBG'[:n % 3])
elif m == RGB:
	print('RGB' * (n // 3) + 'RGB'[:n % 3])
elif m == BRG:
	print('BRG' * (n // 3) + 'BRG'[:n % 3])
elif m == BGR:
	print('BGR' * (n // 3) + 'BGR'[:n % 3])
elif m == GRB:
	print('GRB' * (n // 3) + 'GRB'[:n % 3])
elif m == GBR:
	print('GBR' * (n // 3) + 'GBR'[:n % 3])


n = int(input())
s = input()
s1 = 'RGB' * ((n - 1) // 3 + 1)
s2 = 'GRB' * ((n - 1) // 3 + 1)
s3 = 'BGR' * ((n - 1) // 3 + 1)
s4 = 'BRG' * ((n - 1) // 3 + 1)
s5 = 'RBG' * ((n - 1) // 3 + 1)
s6 = 'GBR' * ((n - 1) // 3 + 1)
ans1 = 0
ans2 = 0
ans3 = 0
ans4 = 0
ans5 = 0
ans6 = 0
for i in range(n):
	if s[i] != s1[i]:
		ans1 += 1
	if s[i] != s2[i]:
		ans2 += 1
	if s[i] != s3[i]:
		ans3 += 1
	if s[i] != s4[i]:
		ans4 += 1
	if s[i] != s5[i]:
		ans5 += 1
	if s[i] != s6[i]:
		ans6 += 1
ans = min(ans1, ans2, ans3, ans4, ans5, ans6)
print(ans)
if ans == ans1:
	print(s1[:n])
elif ans == ans2:
	print(s2[:n])
elif ans == ans3:
	print(s3[:n])
elif ans == ans4:
	print(s4[:n])
elif ans == ans5:
	print(s5[:n])
elif ans == ans6:
	print(s6[:n])


n = int(input())
s = input()
lst = ['RGB', 'RBG', 'BGR', 'BRG', 'GBR', 'GRB']
k = n // 3
lst_s = [k * i + i[:n % 3] for i in lst]
x = 0

def str_ind(s1, s2):
	x = 0
	ret = 0
	for i in s1:
		if i != s2[x]:
			ret += 1
		x += 1
	return ret
lst_ind = [str_ind(lst_s[i], s) for i in range(6)]
print(min(lst_ind))
print(lst_s[lst_ind.index(min(lst_ind))])


n = int(input())
s = input()
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if s[0] == s[1]:
		print(1)
		print(s[0] + 'G' if s[0] != 'G' else s[0] + 'B')
	else:
		print(0)
		print(s)
else:
	l = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
	dic = {'R': 0, 'G': 1, 'B': 2}
	dic1 = ['R', 'G', 'B']
	for i in range(n):
		l[i % 3][dic[s[i]]] += 1
	min = n
	i = 0
	j = 0
	x = 0
	y = 0
	z = 0
	while i < 3:
		while j < 3:
			if j != i:
				k = sum(l[0]) + sum(l[1]) + sum(l[2]) - l[0][i] - l[1][j] - l[2][3 - i - j]
				if k < min:
					min = k
					x = i
					y = j
					z = 3 - x - y
			j += 1
		j = 0
		i += 1
	print(min)
	for i in range(n):
		if i % 3 == 0:
			print(dic1[x], end='')
		elif i % 3 == 1:
			print(dic1[y], end='')
		else:
			print(dic1[z], end='')


n = int(input())
s = input()
cnt = []
start = 0
for i in range(1, n):
	if s[i] != s[start]:
		cnt.append((s[start], i - start))
		start = i
cnt.append((s[start], n - start))
ans = []
c = 0
al = {'R', 'G', 'B'}
for i in range(len(cnt)):
	if cnt[i][1] > 1:
		c += cnt[i][1] // 2
		if i + 1 != len(cnt):
			a = al.difference({cnt[i][0], cnt[i + 1][0]})
			a = a.pop()
		else:
			a = al.difference({cnt[i][0]})
			a = a.pop()
		ans.append('{}{}'.format(cnt[i][0], a) * (cnt[i][1] // 2) + (cnt[i][0] if cnt[i][1] % 2 == 1 else ''))
	else:
		ans.append(cnt[i][0])
print(c)
print(*ans, sep='')


def change(col1, col2):
	if col1 == col2:
		if col1 == 'R':
			return 'G'
		elif col1 == 'G':
			return 'R'
		else:
			return 'R'
	elif col1 == 'R' and col2 == 'G' or (col1 == 'G' and col2 == 'R'):
		return 'B'
	elif col1 == 'R' and col2 == 'B' or (col1 == 'B' and col2 == 'R'):
		return 'G'
	elif col1 == 'B' and col2 == 'G' or (col1 == 'G' and col2 == 'B'):
		return 'R'
n = int(input())
s = list(input())
num = 0
for (ind, let) in enumerate(s):
	if ind == 0:
		continue
	if s[ind - 1] == let:
		num += 1
		if ind == len(s) - 1:
			s[ind] = change(s[ind - 1], s[ind - 1])
		else:
			s[ind] = change(s[ind - 1], s[ind + 1])
print(num)
print(''.join(s))


n = int(input())
s = input()
l = list(s)
reps = []
i = 0
while i < n:
	start = i
	end = i + 1
	while end < n and l[start] == l[end]:
		end += 1
	if end - start > 1:
		reps.append([start, end - 1])
	i = end
ans = 0
for fix in reps:
	for j in range(fix[0] + 1, fix[1] + 1, 2):
		mid = l[j]
		if j - 1 >= 0:
			L = l[j - 1]
		else:
			L = None
		if j + 1 < n:
			R = l[j + 1]
		else:
			R = None
		don = {L, R}
		col = {'R', 'G', 'B'}
		can = col - don
		for e in can:
			take = e
			break
		l[j] = take
		ans += 1
print(ans)
print(''.join(l))


def ans(n, g, gset):
	ans = 10000000000000000000000000
	gar = None
	for v in gset:
		count = 0
		for i in range(0, n - n % 3, 3):
			if g[i] != v[0]:
				count += 1
			if g[i + 1] != v[1]:
				count += 1
			if g[i + 2] != v[2]:
				count += 1
		if n % 3 != 0:
			r = n % 3
			for i in range(r):
				if v[r - i - 1] != g[len(g) - 1 - i]:
					count += 1
		if count < ans:
			ans = count
			gar = v
	return [ans, gar]
n = int(input())
g = input()
gset = ['GRB', 'GBR', 'RGB', 'RBG', 'BGR', 'BRG']
res = ans(n, g, gset)
print(res[0])
gar = res[1] * (n // 3)
if n % 3 != 0:
	mod = n % 3
	ext = res[1][0:mod]
	gar += ext
print(gar)


from sys import stdin, stdout
from sys import stdin, stdout
val = ['', '', '', '', '', '']

def pre_compute():
	global val
	val[0] = 'RGB' * 200000
	val[1] = 'RBG' * 200000
	val[2] = 'BGR' * 200000
	val[3] = 'BRG' * 200000
	val[4] = 'GRB' * 200000
	val[5] = 'GBR' * 200000

def get_changes(s, ss):
	cnt = 0
	for (x, y) in zip(s, ss):
		if x != y:
			cnt += 1
	return cnt
pre_compute()
n = int(input())
in_s = input()
min_changes = 999999999999999
ans = ''
for sota in val:
	changes = get_changes(in_s, sota[:len(in_s)])
	if changes < min_changes:
		ans = sota[:len(in_s)]
		min_changes = changes
print(min_changes)
print(ans)


n = int(input())
last_idx = n - 1
s = input()
c_map = {'R': 'G', 'G': 'B', 'B': 'R'}
c_idx = {'R': 0, 'G': 1, 'B': 2}
new_s = [''] * n
cnt = 0
i = 1
while i < last_idx:
	if s[i - 1] == s[i] and s[i] == s[i + 1]:
		new_s[i] = c_map[s[i]]
		new_s[i + 1] = s[i + 1]
		i += 1
		cnt += 1
	elif s[i - 1] == s[i]:
		new_ch_idx = 3 - (c_idx[s[i]] + c_idx[s[i + 1]])
		new_s[i] = 'R' if new_ch_idx == 0 else 'G' if new_ch_idx == 1 else 'B'
		cnt += 1
	else:
		new_s[i] = s[i]
	i += 1
if n > 1:
	if s[0] == new_s[1]:
		new_s[0] = c_map[new_s[1]]
		cnt += 1
	else:
		new_s[0] = s[0]
	if s[last_idx] == new_s[last_idx - 1]:
		new_s[last_idx] = c_map[new_s[last_idx - 1]]
		cnt += 1
	else:
		new_s[last_idx] = s[last_idx]
	print(cnt)
	print(''.join(new_s))
else:
	print(0)
	print(s)


n = int(input())
s = input()
b = [0] * n
r = [0] * n
g = [0] * n
if s[0] == 'R':
	b[0] = 1
	g[0] = 1
elif s[0] == 'G':
	b[0] = 1
	r[0] = 1
else:
	r[0] = 1
	g[0] = 1
for i in range(1, n):
	if s[i] == 'R':
		r[i] = min(0 + g[i - 1], 0 + b[i - 1])
		g[i] = min(1 + r[i - 1], 1 + b[i - 1])
		b[i] = min(1 + g[i - 1], 1 + r[i - 1])
	elif s[i] == 'G':
		g[i] = min(0 + r[i - 1], 0 + b[i - 1])
		r[i] = min(1 + g[i - 1], 1 + b[i - 1])
		b[i] = min(1 + g[i - 1], 1 + r[i - 1])
	else:
		b[i] = min(0 + g[i - 1], 0 + r[i - 1])
		r[i] = min(1 + g[i - 1], 1 + b[i - 1])
		g[i] = min(1 + r[i - 1], 1 + b[i - 1])
print(min(r[-1], g[-1], b[-1]))
l = min(r[-1], g[-1], b[-1])
w = [''] * n
if l == b[-1]:
	w[-1] = 'B'
elif l == g[-1]:
	w[-1] = 'G'
else:
	w[-1] = 'R'
for i in range(n - 2, -1, -1):
	if w[i + 1] == 'B':
		if r[i] <= g[i]:
			w[i] = 'R'
		else:
			w[i] = 'G'
	elif w[i + 1] == 'G':
		if r[i] <= b[i]:
			w[i] = 'R'
		else:
			w[i] = 'B'
	elif b[i] <= g[i]:
		w[i] = 'B'
	else:
		w[i] = 'G'
print(''.join(w))


n = int(input())
s = input()
m = ''
nn = 0
l = ['R', 'B', 'G']
m += s[0]
for i in range(1, n - 1):
	l = ['R', 'B', 'G']
	if s[i] != m[i - 1]:
		m += s[i]
	elif s[i - 1] == s[i + 1]:
		l.remove(s[i + 1])
		m += l[0]
	else:
		l.remove(m[i - 1])
		if m[i - 1] != s[i + 1]:
			l.remove(s[i + 1])
		m += l[0]
l = ['R', 'B', 'G']
if n != 1:
	if m[n - 2] == s[n - 1]:
		l.remove(m[n - 2])
		m += l[0]
	else:
		m += s[n - 1]
mm = 0
for i in range(n):
	if s[i] != m[i]:
		mm += 1
print(mm)
print(m)


n = int(input())
s = list(input())
res = 0
last = s[0]

def g(a, b):
	d = ['G', 'R', 'B']
	if d[0] != a and d[0] != b:
		return d[0]
	if d[1] != a and d[1] != b:
		return d[1]
	return d[2]
for i in range(1, n):
	if s[i] == last:
		res += 1
		if i + 1 < n:
			s[i] = g(last, s[i + 1])
		else:
			s[i] = g(last, '-1')
	last = s[i]
print(res)
print(''.join(s))


n = int(input())
s = input()
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if s[0] == s[1]:
		if s[0] == 'R':
			print(1)
			print('RB')
		elif s[0] == 'G':
			print(1)
			print('GR')
		else:
			print(1)
			print('GB')
	else:
		print(0)
		print(s)
else:
	cnt = 0
	s = list(s)
	for i in range(0, n - 2):
		if s[i] == s[i + 1]:
			if s[i + 1] == s[i + 2]:
				if s[i + 1] == 'R':
					s[i + 1] = 'B'
					cnt += 1
				elif s[i + 1] == 'B':
					s[i + 1] = 'R'
					cnt += 1
				else:
					s[i + 1] = 'R'
					cnt += 1
			elif s[i + 1] != s[i + 2]:
				if s[i + 1] == 'R' and s[i + 2] == 'G':
					s[i + 1] = 'B'
					cnt += 1
				elif s[i + 1] == 'R' and s[i + 2] == 'B':
					s[i + 1] = 'G'
					cnt += 1
				elif s[i + 1] == 'G' and s[i + 2] == 'B':
					s[i + 1] = 'R'
					cnt += 1
				elif s[i + 1] == 'G' and s[i + 2] == 'R':
					s[i + 1] = 'B'
					cnt += 1
				elif s[i + 1] == 'B' and s[i + 2] == 'G':
					s[i + 1] = 'R'
					cnt += 1
				elif s[i + 1] == 'B' and s[i + 2] == 'R':
					s[i + 1] = 'G'
					cnt += 1
	if s[-2] == s[-1]:
		if s[-1] == 'R':
			s[-1] = 'B'
			cnt += 1
		elif s[-1] == 'B':
			s[-1] = 'R'
			cnt += 1
		else:
			s[-1] = 'R'
			cnt += 1
	print(cnt)
	print(''.join(s))


def permutations(string):
	permutation_list = []
	if len(string) == 1:
		return [string]
	else:
		for char in string:
			[permutation_list.append(char + a) for a in permutations(string.replace(char, ''))]
	return permutation_list

def comp(l1):
	count = 0
	for i in range(n):
		if l1[i] != color[i]:
			count += 1
	return count
n = int(input())
tab = [0] * n
color = list(input())
tab1 = ['R'] * n
tab2 = ['B'] * n
tab3 = ['G'] * n
for i in range(n):
	tab[i] = i % 3
perm = permutations('RGB')
tabPoss = [['R' for j in range(n)] for i in range(6)]
count = 0
for e in perm:
	for i in range(n):
		tabPoss[count][i] = e[i % 3]
	count += 1
res = n + 1
top = -1
for i in range(6):
	data = comp(tabPoss[i])
	if res > data:
		res = data
		top = i
print(res)
print(''.join(tabPoss[top]))


from itertools import permutations as P

def check(*args):
	cu = 0
	for j in range(3):
		for i in range(j, args[3], 3):
			if s[i] != args[j]:
				cu += 1
	return cu
n = int(input())
s = list(input())
res = float('inf')
for i in P('RGB'):
	tmp = check(i[0], i[1], i[2], n)
	if tmp < res:
		res = tmp
		ans = i[0] + i[1] + i[2]
print(res)
for j in range(3):
	for i in range(j, n, 3):
		if s[i] != ans[j]:
			s[i] = ans[j]
print(''.join(s))


n = int(input())
l = input()
s = []
for i in range(n):
	s.append(l[i])
k = 0
c = set()
q = set('RGB')
if n == 1:
	print(0)
	print(s[0])
else:
	for i in range(n - 2):
		if s[i] == s[i + 1]:
			k += 1
			c.add(s[i])
			c.add(s[i + 2])
			w = list(q - c)[0]
			s[i + 1] = w
			c = set()
	if s[n - 1] == s[n - 2]:
		c.add(s[n - 2])
		w = list(q - c)[0]
		s[n - 1] = w
		k += 1
	print(k)
	print(*s, sep='')


def solve():
	pat = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
	n = int(input())
	s = input()
	j = 0
	minimal = n
	sout = ''
	while j < 6:
		i = 0
		tp = 0
		smod = ''
		while i < n:
			if s[i] != pat[j][(i + 1) % 3 - 1]:
				tp += 1
			smod += pat[j][(i + 1) % 3 - 1]
			i += 1
		if tp <= minimal:
			sout = smod
			minimal = tp
		j += 1
	print(minimal)
	print(sout)
solve()


n = int(input())
st = list(input())
ans = int(2 * 1000000.0)
s = ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']
an = ''
for i in range(6):
	cnt = 0
	k = ''
	cc = s[i]
	for j in range(n):
		k += cc[j % 3]
		if cc[j % 3] != st[j]:
			cnt += 1
	if cnt < ans:
		ans = cnt
		an = k
print(str(ans) + '\n' + an)


import math
contador = 0
i = int(input())
s = input()
if i == 1:
	print(0)
	print(s)
else:
	garden = list(s)
	ant = garden[0]
	for b in range(1, i - 1):
		if garden[b] == ant:
			contador += 1
			if ant != 'R' and garden[b + 1] != 'R':
				garden[b] = 'R'
			elif ant != 'G' and garden[b + 1] != 'G':
				garden[b] = 'G'
			elif ant != 'B' and garden[b + 1] != 'B':
				garden[b] = 'B'
		ant = garden[b]
	if ant == 'R' and garden[i - 1] == 'R':
		garden[i - 1] = 'G'
		contador += 1
	elif ant == 'G' and garden[i - 1] == 'G':
		garden[i - 1] = 'B'
		contador += 1
	elif ant == 'B' and garden[i - 1] == 'B':
		garden[i - 1] = 'R'
		contador += 1
	print(contador)
	s = ''.join(garden)
	print(s)


from itertools import cycle
n = int(input())
s = input()
a = [{0: 'R', 1: 'G', 2: 'B'}, {0: 'R', 1: 'B', 2: 'G'}, {0: 'B', 1: 'R', 2: 'G'}, {0: 'B', 1: 'G', 2: 'R'}, {0: 'G', 1: 'B', 2: 'R'}, {0: 'G', 1: 'R', 2: 'B'}]
ans = [0, 0, 0, 0, 0, 0]
for i in range(n):
	for j in range(6):
		if a[j][i % 3] != s[i]:
			ans[j] += 1
print(min(ans))
j = ans.index(min(ans))
k = a[j]
c = k[0] + k[1] + k[2]
t = cycle(c)
for i in range(n):
	print(next(t), end='')


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
lens = read_int()
ins = [x for x in input()] + ['-']
move = 0
ans = ins[0]
for i in range(1, lens):
	if ins[i - 1] != ins[i]:
		continue
	else:
		move += 1
		for j in 'RGB':
			if j != ins[i - 1] and j != ins[i + 1]:
				ins[i] = j
print(move)
print(''.join(ins[:-1]))


from sys import stdout, stdin
n = int(input())
s = stdin.readline()
l = []
temp = ['R', 'G', 'B']
for i in s:
	l.append(i)
c = 0
for i in range(1, n):
	if l[i] == l[i - 1]:
		c += 1
		if i != n - 1:
			for j in temp:
				if j != l[i] and j != l[i + 1]:
					l[i] = j
					break
		else:
			for j in temp:
				if j != l[i]:
					l[i] = j
					break
print(c)
s = ''
for i in l:
	s += i
stdout.write(s)


from itertools import permutations
n = int(input())
s = input()
convert = list('RGB')
hoge = []
for i in range(3):
	use = s[i::3]
	k = len(use)
	not_r = k - use.count('R')
	not_g = k - use.count('G')
	not_b = k - use.count('B')
	hoge.append([not_r, not_g, not_b])
scores = []
for p in permutations((0, 1, 2)):
	score = 0
	for i in range(3):
		score += hoge[i][p[i]]
	scores.append([score, p])
scores.sort()
ans = ''
for i in range(len(s)):
	ans += convert[scores[0][1][i % 3]]
print(scores[0][0])
print(ans)


def find_distance(str1, str2):
	dist = 0
	for i in range(len(str1)):
		if str1[i] != str2[i]:
			dist += 1
	return dist

def get_nice_strings(length):
	strings = []
	word_position = 0
	(words1, words2, words3, words4, words5, words6) = (['R', 'G', 'B'], ['R', 'B', 'G'], ['G', 'B', 'R'], ['G', 'R', 'B'], ['B', 'G', 'R'], ['B', 'R', 'G'])
	(str1, str2, str3, str4, str5, str6) = ('', '', '', '', '', '')
	for i in range(length):
		str1 += words1[word_position % 3]
		str2 += words2[word_position % 3]
		str3 += words3[word_position % 3]
		str4 += words4[word_position % 3]
		str5 += words5[word_position % 3]
		str6 += words6[word_position % 3]
		word_position += 1
	strings.append(str1)
	strings.append(str2)
	strings.append(str3)
	strings.append(str4)
	strings.append(str5)
	strings.append(str6)
	return strings

def solution(n, string):
	strings = get_nice_strings(n)
	(min_value, min_nice_string) = (len(string), string)
	for nice_string in strings:
		dist = find_distance(string, nice_string)
		if dist < min_value:
			min_value = dist
			min_nice_string = nice_string
	print(min_value)
	print(min_nice_string)
n = int(input())
string = input()
solution(n, string)


n = int(input())
L = list(input())
Ltemp = L[0]
recol = 0
for i in range(1, n - 1):
	if L[i] == L[i - 1]:
		if L[i] == L[i + 1]:
			if L[i] == 'R':
				L[i] = 'B'
			elif L[i] == 'B':
				L[i] = 'G'
			elif L[i] == 'G':
				L[i] = 'R'
		elif set(L[i:i + 2]) == set(['R', 'B']):
			L[i] = 'G'
		elif set(L[i:i + 2]) == set(['R', 'G']):
			L[i] = 'B'
		elif set(L[i:i + 2]) == set(['G', 'B']):
			L[i] = 'R'
		i += 1
		recol += 1
if L[n - 1] == L[n - 2]:
	if L[n - 1] == 'R':
		L[n - 1] = 'B'
	elif L[n - 1] == 'B':
		L[n - 1] = 'G'
	elif L[n - 1] == 'G':
		L[n - 1] = 'R'
	recol += 1
if n == 1:
	print(0)
	print(Ltemp)
else:
	print(recol)
	print(''.join(L))


from itertools import permutations
N = int(input())
results = []
garland = list(input())
for P in permutations(['R', 'G', 'B']):
	result = 0
	for i in range(N):
		if garland[i] != P[i % 3]:
			result += 1
	results.append((result, P))
print(min(results)[0])
print(''.join((min(results)[1] * N)[:N]))


def colorPick(current, next):
	x = ['R', 'B', 'G']
	for i in x:
		if i != current and i != next:
			return i

def anyother(col):
	x = ['R', 'B', 'G']
	for i in x:
		if i != col:
			return i
n = int(input())
start = 0
end = 0
s = list(input()) + ['%']
ans = []
ct = 0
for i in range(n):
	if s[i] == s[i + 1]:
		end += 1
	else:
		rex = s[start:end + 1]
		if len(rex) <= 1:
			ans += rex
		else:
			if end != n - 1:
				curr = s[start]
				nex = s[end + 1]
				newC = colorPick(curr, nex)
				for i in range(1, len(rex), 2):
					rex[i] = newC
					ct += 1
			else:
				curr = s[start]
				newC = anyother(curr)
				for i in range(1, len(rex), 2):
					rex[i] = newC
					ct += 1
			ans += rex
		start = end + 1
		end += 1
print(ct)
print(''.join(ans))


import math
n = int(input())
l = list(input())
count = 1
total = 0
for j in range(1, n + 1):
	if j != n and l[j] == l[j - 1]:
		count += 1
	else:
		val = ['R', 'G', 'B']
		val.remove(l[j - 1])
		if j < n:
			val.remove(l[j])
		for k in range(j - count + 1, j, 2):
			l[k] = val[0]
			total += 1
		count = 1
print(total)
print(*l, sep='')


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
l = ls()
ch = ['R', 'G', 'B']
c = 0
for i in range(1, n - 1):
	if l[i] == l[i - 1]:
		c += 1
		for j in ch:
			if j != l[i - 1] and j != l[i + 1]:
				l[i] = j
if n >= 2 and l[-1] == l[-2]:
	c += 1
	for j in ch:
		if j != l[-2]:
			l[-1] = j
print(c)
print(''.join(l))


n = int(input())
a = list(input().strip())
cost = 0
for i in range(n - 1):
	if a[i] != a[i + 1]:
		continue
	else:
		cost += 1
		if a[i] == 'R':
			if i + 2 < n and a[i + 2] == 'R':
				a[i + 1] = 'B'
			elif i + 2 < n and a[i + 2] == 'G':
				a[i + 1] = 'B'
			elif i + 2 < n and a[i + 2] == 'B':
				a[i + 1] = 'G'
			else:
				a[i + 1] = 'G'
		elif a[i] == 'G':
			if i + 2 < n and a[i + 2] == 'R':
				a[i + 1] = 'B'
			elif i + 2 < n and a[i + 2] == 'G':
				a[i + 1] = 'R'
			elif i + 2 < n and a[i + 2] == 'B':
				a[i + 1] = 'R'
			else:
				a[i + 1] = 'R'
		elif a[i] == 'B':
			if i + 2 < n and a[i + 2] == 'R':
				a[i + 1] = 'G'
			elif i + 2 < n and a[i + 2] == 'G':
				a[i + 1] = 'R'
			elif i + 2 < n and a[i + 2] == 'B':
				a[i + 1] = 'R'
			else:
				a[i + 1] = 'R'
print(cost)
print(*a, sep='')


n = int(input())
s = input()
a = []
cl = ['R', 'B', 'G']
(ans, ck) = (0, False)
for i in range(1, len(s)):
	if s[i] == s[i - 1] and (not ck):
		ans += 1
		ck = True
		for j in cl:
			if i == len(s) - 1:
				if j != s[i - 1]:
					a.append(j)
					break
			if j != s[i - 1] and (i < len(s) - 1 and j != s[i + 1]):
				a.append(j)
				break
	else:
		a.append(s[i])
		ck = False
if len(s) <= 2:
	if len(s) == 1:
		print(0, s, sep='\n')
	elif s[0] != s[1]:
		print(0, s, sep='\n')
	else:
		for i in cl:
			if i != s[0]:
				print(1)
				print(s[0], i, sep='')
				exit()
else:
	print(ans)
	print(s[0], *a, sep='')


def deal(a, b, c='0'):
	if c == '0' or a == c:
		if a == 'R':
			return 'B'
		if a == 'B':
			return 'R'
		if a == 'G':
			return 'B'
	if a == 'R' and c == 'B':
		b = 'G'
	if a == 'R' and c == 'G':
		b = 'B'
	if a == 'B' and c == 'R':
		b = 'G'
	if a == 'B' and c == 'G':
		b = 'R'
	if a == 'G' and c == 'B':
		b = 'R'
	if a == 'G' and c == 'R':
		b = 'B'
	return b
n = int(input())
ss = input()
s = list(ss)
answer = [s[0]]
number = 0
for i in range(0, n - 1):
	ans = ''
	if s[i] == s[i + 1]:
		number += 1
		if i == n - 2:
			ans = deal(s[i], s[i + 1])
		else:
			ans = deal(s[i], s[i + 1], s[i + 2])
		s[i + 1] = ans
		answer.append(ans)
	else:
		answer.append(s[i + 1])
s = ''.join(answer)
print(number)
print(s)


def C():
	n = int(input())
	s = input()
	cases = ['BGR', 'BRG', 'GBR', 'GRB', 'RBG', 'RGB']
	dist = [0] * 6
	for i in range(n):
		for j in dist:
			j += 1
		if s[i] == 'B':
			if i % 3 == 0:
				dist[0] -= 1
				dist[1] -= 1
			elif i % 3 == 1:
				dist[2] -= 1
				dist[4] -= 1
			else:
				dist[3] -= 1
				dist[5] -= 1
		elif s[i] == 'G':
			if i % 3 == 0:
				dist[2] -= 1
				dist[3] -= 1
			elif i % 3 == 1:
				dist[0] -= 1
				dist[5] -= 1
			else:
				dist[1] -= 1
				dist[4] -= 1
		elif i % 3 == 0:
			dist[4] -= 1
			dist[5] -= 1
		elif i % 3 == 1:
			dist[1] -= 1
			dist[3] -= 1
		else:
			dist[0] -= 1
			dist[2] -= 1
	a = 0
	for i in range(6):
		if dist[i] < dist[a]:
			a = i
	ans = cases[a] * (n // 3)
	ans += cases[a][:n % 3]
	cost = 0
	for i in range(n):
		if ans[i] != s[i]:
			cost += 1
	print(cost)
	print(ans)
C()


n = int(input())
s = input()
s = s + '#'
arr = [0]
c = 1
for i in range(1, n + 1):
	if s[i] == s[i - 1]:
		c += 1
	else:
		arr.append(c)
		c = 1
a = 0
for i in arr:
	a += i // 2
arr2 = arr[:]
for i in range(1, len(arr)):
	arr[i] = arr[i] + arr[i - 1]
print(a)
ans2 = ''
options = ['R', 'G', 'B']
for i in range(1, len(arr)):
	ind = False
	for j in range(arr[i - 1], arr[i]):
		if not ind:
			ans2 += s[j]
		elif s[j] == 'R':
			if s[j + 1] == 'G':
				ans2 += 'B'
			else:
				ans2 += 'G'
		elif s[j] == 'G':
			if s[j + 1] == 'B':
				ans2 += 'R'
			else:
				ans2 += 'B'
		elif s[j] == 'B':
			if s[j + 1] == 'G':
				ans2 += 'R'
			else:
				ans2 += 'G'
		ind = not ind
print(ans2)


n = int(input())
str = input()
s = list(str)
col = ['R', 'G', 'B']
c = 0
if n == 1:
	print(0)
	print(''.join(s))
	exit(0)
if n == 2:
	if s[0] == s[1]:
		print(1)
		for i in col:
			if i != s[0]:
				print(s[0] + i)
				exit(0)
for i in range(n - 1):
	if s[i] == s[i + 1]:
		if i + 2 < n:
			for k in col:
				if k != s[i] and k != s[i + 2]:
					s[i + 1] = k
		else:
			for k in col:
				if k != s[i]:
					s[i + 1] = k
		c += 1
print(c)
print(''.join(s))


n = int(input())
s = input()
l = []
c = [s[0]]
i = 1
co = 1
while i < n:
	if s[i] == s[i - 1]:
		co += 1
	else:
		c.append(s[i])
		l.append(co)
		co = 1
	i += 1
l.append(co)
res = ''
pr = -1
cou = 0
for i in range(len(l)):
	if l[i] == 1:
		res += c[i]
		pr = s[i]
	else:
		a = l[i]
		if l[i] % 2 == 1:
			aa = a // 2
			for k in ['R', 'G', 'B']:
				if c[i] != k:
					break
			ss = c[i] + k
			res += ss * aa
			res += c[i]
			cou += aa
		else:
			aa = a // 2
			cou += aa
			if i == 0:
				for k in ['R', 'G', 'B']:
					if c[i] != k:
						break
				ss = k + c[i]
				res += ss * aa
			else:
				for k in ['R', 'G', 'B']:
					if c[i] != k and c[i - 1] != k:
						break
				ss = k + c[i]
				res += ss * aa
print(cou)
print(res)


import sys, math, string
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
n = int(input())
s = input().strip()
c1 = 0
c2 = 0
c3 = 0
c4 = 0
c5 = 0
c6 = 0
for i in range(0, n, 3):
	p = s[i:i + 3]
	if p[0] == 'R':
		c5 += 1
		c3 += 1
		c4 += 1
		c6 += 1
	if p[0] == 'G':
		c1 += 1
		c2 += 1
		c5 += 1
		c6 += 1
	if p[0] == 'B':
		c1 += 1
		c2 += 1
		c3 += 1
		c4 += 1
	if len(p) > 1:
		if p[1] == 'R':
			c1 += 1
			c2 += 1
			c4 += 1
			c6 += 1
		if p[1] == 'B':
			c1 += 1
			c3 += 1
			c5 += 1
			c6 += 1
		if p[1] == 'G':
			c5 += 1
			c3 += 1
			c4 += 1
			c2 += 1
	if len(p) > 2:
		if p[2] == 'R':
			c1 += 1
			c2 += 1
			c3 += 1
			c5 += 1
		if p[2] == 'G':
			c1 += 1
			c3 += 1
			c4 += 1
			c6 += 1
		if p[2] == 'B':
			c5 += 1
			c2 += 1
			c4 += 1
			c6 += 1
if min(c1, c2, c3, c4, c5, c6) == c1:
	k = 'RGB' * (n // 3) + 'RGB'[:n % 3]
	print(c1)
	print(k)
elif min(c1, c2, c3, c4, c5, c6) == c2:
	k = 'RBG' * (n // 3) + 'RBG'[:n % 3]
	print(c2)
	print(k)
elif min(c1, c2, c3, c4, c5, c6) == c3:
	k = 'GRB' * (n // 3) + 'GRB'[:n % 3]
	print(c3)
	print(k)
elif min(c1, c2, c3, c4, c5, c6) == c4:
	k = 'GBR' * (n // 3) + 'GBR'[:n % 3]
	print(c4)
	print(k)
elif min(c1, c2, c3, c4, c5, c6) == c5:
	k = 'BRG' * (n // 3) + 'BRG'[:n % 3]
	print(c5)
	print(k)
elif min(c1, c2, c3, c4, c5, c6) == c6:
	k = 'BGR' * (n // 3) + 'BGR'[:n % 3]
	print(c6)
	print(k)


n = int(input())
s = input()
s1 = 'RGB' * (n // 3) + 'RGB'[:n % 3]
s2 = 'GBR' * (n // 3) + 'GBR'[:n % 3]
s3 = 'BRG' * (n // 3) + 'BRG'[:n % 3]
s4 = 'BGR' * (n // 3) + 'BGR'[:n % 3]
s5 = 'GRB' * (n // 3) + 'GRB'[:n % 3]
s6 = 'RBG' * (n // 3) + 'RBG'[:n % 3]
c1 = 0
c2 = 0
c3 = 0
c4 = 0
c5 = 0
c6 = 0
for i in range(n):
	if s[i] != s1[i]:
		c1 += 1
	if s[i] != s2[i]:
		c2 += 1
	if s[i] != s3[i]:
		c3 += 1
	if s[i] != s4[i]:
		c4 += 1
	if s[i] != s5[i]:
		c5 += 1
	if s[i] != s6[i]:
		c6 += 1
m = min(c1, c2, c3, c4, c5, c6)
print(m)
if c1 == m:
	print(s1)
elif c2 == m:
	print(s2)
elif c3 == m:
	print(s3)
elif c4 == m:
	print(s4)
elif c5 == m:
	print(s5)
else:
	print(s6)


n = int(input())
s = [tmp for tmp in input().strip()]
ll = ['R', 'G', 'B']
dl = {'R': 0, 'G': 1, 'B': 2}
f = [0] * 9
for sh in range(3):
	for i in range(sh, n, 3):
		f[sh * 3 + dl[s[i]]] += 1
lseq = []
minch = n + 1
for l1 in range(3):
	for l2 in range(3):
		if l2 == l1:
			continue
		for l3 in range(3):
			if l3 == l1 or l3 == l2:
				continue
			tch = sum(f[:3]) - f[l1] + sum(f[3:6]) - f[3 + l2] + sum(f[6:9]) - f[6 + l3]
			if tch < minch:
				minch = tch
				lseq = [ll[l1], ll[l2], ll[l3]]
r = 0
for sh in range(3):
	for i in range(sh, n, 3):
		if s[i] != lseq[sh]:
			s[i] = lseq[sh]
			r += 1
print(r)
print(*s, sep='')


n = int(input())
x = input()
i = 0
ans = ''
min = 0
while i < len(x) - 1:
	if x[i] != x[i + 1]:
		ans += x[i]
		i += 1
	else:
		j = i
		while i < len(x) and x[j] == x[i]:
			if (i - j) % 2 == 0:
				ans += x[i]
			else:
				if i + 1 < len(x):
					if x[i] == 'R' and x[i + 1] == 'B':
						ans += 'G'
					if x[i] == 'R' and x[i + 1] == 'G':
						ans += 'B'
					if x[i] == 'R' and x[i + 1] == 'R':
						ans += 'G'
					if x[i] == 'G' and x[i + 1] == 'B':
						ans += 'R'
					if x[i] == 'G' and x[i + 1] == 'G':
						ans += 'R'
					if x[i] == 'G' and x[i + 1] == 'R':
						ans += 'B'
					if x[i] == 'B' and x[i + 1] == 'R':
						ans += 'G'
					if x[i] == 'B' and x[i + 1] == 'B':
						ans += 'G'
					if x[i] == 'B' and x[i + 1] == 'G':
						ans += 'R'
				else:
					if x[i] == 'R':
						ans += 'G'
					if x[i] == 'G':
						ans += 'B'
					if x[i] == 'B':
						ans += 'G'
				min += 1
			i += 1
if len(ans) < len(x):
	ans += x[-1]
print(min)
print(ans)


def check(pat, s):
	cnt = 0
	st = ''
	for i in range(len(s) // 3):
		if s[3 * i] != pat[0]:
			cnt += 1
		if s[3 * i + 1] != pat[1]:
			cnt += 1
		if s[3 * i + 2] != pat[2]:
			cnt += 1
	st = pat * (len(s) // 3)
	if len(s) % 3 != 0:
		val = len(s) // 3 * 3
		for i in range(len(s) % 3):
			if s[i + val] != pat[i]:
				cnt += 1
			st += pat[i]
	return [cnt, st]
n = int(input())
s = input().strip()
ans = n
st = ''
combs = ['RBG', 'RGB', 'GBR', 'GRB', 'BRG', 'BGR']
for comb in combs:
	ss = check(comb, s)
	if ss[0] < ans:
		ans = ss[0]
		st = ss[1]
print(ans)
print(st)


from sys import stdin
n = int(input())
l = list(stdin.readline().rstrip())
c = 0
if n == 1:
	print(0)
	print(l[0])
else:
	for i in range(n - 1):
		if l[i] == l[i + 1]:
			if i < n - 2:
				if l[i] == l[i + 1] == l[i + 2]:
					if l[i] == 'R' or l[i] == 'G':
						l[i + 1] = 'B'
					else:
						l[i + 1] = 'R'
				elif l[i] == 'R' and l[i + 2] == 'G':
					l[i + 1] = 'B'
				elif l[i] == 'G' and l[i + 2] == 'R':
					l[i + 1] = 'B'
				elif l[i] == 'G' and l[i + 2] == 'B':
					l[i + 1] = 'R'
				elif l[i] == 'B' and l[i + 2] == 'G':
					l[i + 1] = 'R'
				elif l[i] == 'R' and l[i + 2] == 'B':
					l[i + 1] = 'G'
				elif l[i] == 'B' and l[i + 2] == 'R':
					l[i + 1] = 'G'
			elif l[i] == 'R' or l[i] == 'G':
				l[i + 1] = 'B'
			else:
				l[i + 1] = 'R'
			c += 1
	print(c)
	for i in range(n):
		print(l[i], end='')


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	n = int(input())
	s = str(input())
	(l, r) = (0, 0)
	res = []
	while r < n:
		while r < n and s[l] == s[r]:
			r += 1
		res.append((r - l, s[l]))
		l = r
	t = []
	pos = 0
	for r in res:
		pos += r[0]
		if r[0] > 1:
			if r[0] % 2 == 0:
				cnt = r[0] // 2
				while cnt > 0:
					t.append(pos - 1 - (cnt - 1) * 2)
					cnt -= 1
			else:
				cnt = r[0] // 2
				while cnt > 0:
					t.append(pos - 2 - (cnt - 1) * 2)
					cnt -= 1
	print(len(t))
	ans = list(s)
	rgb = ['R', 'G', 'B']
	for j in t:
		for x in rgb:
			ans[j] = x
			if j == n - 1 and ans[j - 1] != x:
				break
			if j != n - 1 and ans[j - 1] != x and (ans[j + 1] != x):
				break
	print(''.join(ans))
main()


n = int(input())
s = input()
t = ['RGB', 'RBG', 'GRB', 'GBR', 'BGR', 'BRG']
ans = [0] * len(t)
for string in range(len(t)):
	for i in range(n):
		if s[i] != t[string][i % 3]:
			ans[string] += 1
print(min(ans))
key = t[ans.index(min(ans))]
for i in range(n):
	print(key[i % 3], end='')
print()


(lambda l, s, c: [s.append('X'), [[s.__setitem__(i, 'R' if s[i - 1] != 'R' and s[i + 1] != 'R' else 'G' if s[i - 1] != 'G' and s[i + 1] != 'G' else 'B'), c.__setitem__(0, c[0] + 1)] for i in range(1, l) if s[i] == s[i - 1]], print(c[0], ''.join(s[:-1]), sep='\n')])(int(input()), list(input()), [0])


def compute_number_of_recolors(n, s, pattern):
	counter = 0
	for i in range(0, n):
		if s[i] != pattern[i % 3]:
			counter = counter + 1
	return counter
n = int(input())
s = input()
p0 = 'RBG'
p1 = 'RGB'
p2 = 'BRG'
p3 = 'BGR'
p4 = 'GRB'
p5 = 'GBR'
PATTERNS = [p0, p1, p2, p3, p4, p5]
NUMBER_OF_PATTERNS = 6
res = n
for i in range(0, NUMBER_OF_PATTERNS):
	recolors = compute_number_of_recolors(n, s, PATTERNS[i])
	if res >= recolors:
		res = recolors
		patern = PATTERNS[i]
print(res)
print((patern * n)[0:n])


import sys
n = int(input())
s = list(sys.stdin.readline().strip())
p = 0
for j in range(1, n - 1):
	if s[j] == s[j - 1]:
		if s[j - 1] != 'R' and s[j + 1] != 'R':
			s[j] = 'R'
		elif s[j - 1] != 'G' and s[j + 1] != 'G':
			s[j] = 'G'
		else:
			s[j] = 'B'
		p = p + 1
if n >= 2:
	if s[-2] == s[-1]:
		p = p + 1
		if s[-2] != 'R':
			s[-1] = 'R'
		else:
			s[-1] = 'B'
print(p)
print(''.join(s))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def main():
	n = I()
	s = S() + '-'
	r = 0
	rr = [s[0]]
	for i in range(1, n):
		c = s[i]
		if c == rr[-1]:
			r += 1
			t = s[i + 1]
			c = [k for k in 'RGB' if k not in [c, t]][0]
		rr.append(c)
	return '{}\n{}'.format(r, JA(rr, ''))
print(main())


n = int(input())
s = input()
(s_out, c) = (s[0], 0)
for i in range(1, n):
	ch = s[i]
	if s_out[-1] == s[i]:
		if i != n - 1:
			if (s_out[-1] == 'R' or s_out[-1] == 'G') and (s[i + 1] == 'R' or s[i + 1] == 'G'):
				ch = 'B'
			elif (s_out[-1] == 'R' or s_out[-1] == 'B') and (s[i + 1] == 'R' or s[i + 1] == 'B'):
				ch = 'G'
			else:
				ch = 'R'
		elif s_out[-1] == 'R' or s_out[-1] == 'G':
			ch = 'B'
		else:
			ch = 'G'
		c += 1
	s_out += ch
print(c)
print(s_out)


n = int(input())
s = list(input())
ans = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		for x in 'RGB':
			if x == s[i - 1] or (i + 1 < n and s[i + 1] == x):
				continue
			s[i] = x
		ans += 1
print(ans)
print(''.join(s))


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())
flower = input()
dup = n // 3 + 1
possible = [('RGB' * dup)[:n], ('GBR' * dup)[:n], ('BRG' * dup)[:n], ('GRB' * dup)[:n], ('RBG' * dup)[:n], ('BGR' * dup)[:n]]
ans = n
idx = 0
for i in possible:
	times = 0
	for (a, b) in zip(flower, i):
		if a != b:
			times += 1
	if times < ans:
		ans = times
		idx = i
print(ans)
print(idx)


(n, a) = (int(input()), input())
b = [['R', 'G', 'B'], ['R', 'B', 'G'], ['G', 'B', 'R'], ['G', 'R', 'B'], ['B', 'R', 'G'], ['B', 'G', 'R']]
x = [0, 0, 0, 0, 0, 0]
for i in range(n):
	for j in range(6):
		if a[i] != b[j][i % 3]:
			x[j] += 1
minn = min(x)
print(minn)
for i in range(6):
	if minn == x[i]:
		ans = b[i] * (n // 3)
		if n % 3:
			for j in range(n % 3):
				ans += b[i][j]
		for j in range(n):
			print(ans[j], end='')
		break


n = int(input())
s = input()
arr = []
rb = 0
rg = 0
rr = 0
for i in s:
	arr.append(i)
	if i == 'R':
		rr += 1
	if i == 'B':
		rb += 1
	if i == 'G':
		rg += 1
xx = 0
for i in range(1, len(arr)):
	if arr[i - 1] != arr[i]:
		if arr[i - 1] == 'R':
			rr -= 1
		if arr[i - 1] == 'G':
			rg -= 1
		if arr[i - 1] == 'B':
			rb -= 1
		continue
	else:
		xx += 1
		if arr[i - 1] == 'R':
			if i + 1 < n:
				if arr[i + 1] == 'R':
					arr[i] = 'B'
				if arr[i + 1] == 'B':
					arr[i] = 'G'
				if arr[i + 1] == 'G':
					arr[i] = 'B'
			else:
				arr[i] = 'B'
		if arr[i - 1] == 'B':
			if i + 1 < n:
				if arr[i + 1] == 'R':
					arr[i] = 'G'
				if arr[i + 1] == 'B':
					arr[i] = 'G'
				if arr[i + 1] == 'G':
					arr[i] = 'R'
			else:
				arr[i] = 'G'
		if arr[i - 1] == 'G':
			if i + 1 < n:
				if arr[i + 1] == 'R':
					arr[i] = 'B'
				if arr[i + 1] == 'B':
					arr[i] = 'R'
				if arr[i + 1] == 'G':
					arr[i] = 'B'
			else:
				arr[i] = 'B'
print(xx)
print(''.join(arr))


n = int(input())
s = input()
a = ['RGB', 'RBG', 'BGR', 'BRG', 'GBR', 'GRB']
d = {}
for pat in a:
	cost = 0
	for i in range(0, n, 3):
		for j in range(3):
			if i + j == n:
				break
			if pat[j] != s[i + j]:
				cost += 1
	i = 0
	d[pat] = cost
mincost = min(d.values())
for pat in a:
	if d[pat] == mincost:
		patt = pat
		break
print(mincost)
for i in range(n // 3):
	print(pat, end='')
for i in range(n % 3):
	print(pat[i], end='')


n = int(input())
s = input()
M = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for i in range(n):
	COLOR = s[i]
	if COLOR == 'R':
		x = 0
	if COLOR == 'G':
		x = 1
	if COLOR == 'B':
		x = 2
	M[i % 3][x] += 1
(Min, co) = (n, '')
(p, q) = (n // 3, n % 3)
for ch in ('RGB', 'RBG', 'GBR', 'GRB', 'BRG', 'BGR'):
	N = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
	for i in range(3):
		COLOR = ch[i]
		if COLOR == 'R':
			x = 0
		if COLOR == 'G':
			x = 1
		if COLOR == 'B':
			x = 2
		N[i][x] = p + (q >= i + 1)
	Sum = 0
	for u in range(3):
		for v in range(3):
			Sum += max(0, N[u][v] - M[u][v])
	if Sum < Min:
		Min = Sum
		co = ch
ANS = co * p + co[:q]
print(Min)
print(ANS)


n = int(input())
s = input()
ll = n % 3
a = 'RGB' * (n // 3) + 'RGB'[:n % 3]
b = 'RBG' * (n // 3) + 'RBG'[:n % 3]
c = 'GRB' * (n // 3) + 'GRB'[:n % 3]
d = 'GBR' * (n // 3) + 'GBR'[:n % 3]
e = 'BRG' * (n // 3) + 'BRG'[:n % 3]
f = 'BGR' * (n // 3) + 'BGR'[:n % 3]
(a1, b1, c1, d1, e1, f1) = (0, 0, 0, 0, 0, 0)
for (p, q, r, s, t, u, v) in zip(a, b, c, d, e, f, s):
	if p != v:
		a1 += 1
	if q != v:
		b1 += 1
	if r != v:
		c1 += 1
	if s != v:
		d1 += 1
	if t != v:
		e1 += 1
	if u != v:
		f1 += 1
mn = min(a1, b1, c1, d1, e1, f1)
if a1 == mn:
	print(a1)
	print(a)
elif b1 == mn:
	print(b1)
	print(b)
elif c1 == mn:
	print(c1)
	print(c)
elif d1 == mn:
	print(d1)
	print(d)
elif e1 == mn:
	print(e1)
	print(e)
elif f1 == mn:
	print(f1)
	print(f)


n = int(input())
s = str(input())
s = list(s)
x = s[0]
c = 0
res = 0
for i in range(1, n):
	if s[i] != x:
		y = i - c
		res = res + y // 2
		x = s[i]
		c = i
		if y == 2:
			if s[i] == 'R':
				if s[i - 1] == 'G':
					s[i - 1] = 'B'
				else:
					s[i - 1] = 'G'
			elif s[i] == 'G':
				if s[i - 1] == 'R':
					s[i - 1] = 'B'
				else:
					s[i - 1] = 'R'
			elif s[i - 1] == 'R':
				s[i - 1] = 'G'
			else:
				s[i - 1] = 'R'
		elif y % 2 == 0:
			if s[i - 1] == 'R':
				for j in range(y // 2 - 1):
					s[i - 2 - 2 * j] = 'G'
				j = y // 2 - 2
				s[i - 2 - 2 * j - 1] = 'B'
			elif s[i - 1] == 'G':
				for j in range(y // 2 - 1):
					s[i - 2 - 2 * j] = 'R'
				j = y // 2 - 2
				s[i - 2 - 2 * j - 1] = 'B'
			else:
				for j in range(y // 2 - 1):
					s[i - 2 - 2 * j] = 'R'
				j = y // 2 - 2
				s[i - 2 - 2 * j - 1] = 'G'
		elif s[i - 1] == 'R':
			for j in range(y // 2):
				s[i - 2 - 2 * j] = 'G'
		elif s[i - 1] == 'G':
			for j in range(y // 2):
				s[i - 2 - 2 * j] = 'R'
		else:
			for j in range(y // 2):
				s[i - 2 - 2 * j] = 'R'
res = res + (n - c) // 2
y = n - c
if n - c == 2:
	if s[c] == 'R':
		s[c + 1] = 'G'
	elif s[c] == 'G':
		s[c + 1] = 'B'
	else:
		s[c + 1] = 'G'
elif (n - c) % 2 == 0:
	if s[c] == 'R':
		for j in range(y // 2 - 1):
			s[c + 1 + 2 * j] = 'G'
		j = y // 2 - 2
		s[c + 1 + 2 * j + 1] = 'B'
	elif s[c] == 'G':
		for j in range(y // 2 - 1):
			s[c + 1 + 2 * j] = 'R'
		j = y // 2 - 2
		s[c + 1 + 2 * j + 1] = 'B'
	else:
		for j in range(y // 2 - 1):
			s[c + 1 + 2 * j] = 'R'
		j = y // 2 - 2
		s[c + 1 + 2 * j + 1] = 'G'
elif s[c] == 'R':
	for j in range(y // 2):
		s[c + 1 + 2 * j] = 'G'
elif s[c] == 'G':
	for j in range(y // 2):
		s[c + 1 + 2 * j] = 'R'
else:
	for j in range(y // 2):
		s[c + 1 + 2 * j] = 'R'
print(res)
s = ''.join(s)
print(s)


n = int(input())
s = input()
ans = 1000000000.0
anss = ''
s1 = 'RGB'
cur = 0
for i in range(n):
	if s[i] != s1[i % 3]:
		cur += 1
if ans > cur:
	ans = cur
	anss = s1 * (n // 3)
	if n % 3 == 2:
		anss += s1[0]
		anss += s1[1]
	if n % 3 == 1:
		anss += s1[0]
s1 = 'RBG'
cur = 0
for i in range(n):
	if s[i] != s1[i % 3]:
		cur += 1
if ans > cur:
	ans = cur
	anss = s1 * (n // 3)
	if n % 3 == 2:
		anss += s1[0]
		anss += s1[1]
	if n % 3 == 1:
		anss += s1[0]
s1 = 'BRG'
cur = 0
for i in range(n):
	if s[i] != s1[i % 3]:
		cur += 1
if ans > cur:
	ans = cur
	anss = s1 * (n // 3)
	if n % 3 == 2:
		anss += s1[0]
		anss += s1[1]
	if n % 3 == 1:
		anss += s1[0]
s1 = 'BGR'
cur = 0
for i in range(n):
	if s[i] != s1[i % 3]:
		cur += 1
if ans > cur:
	ans = cur
	anss = s1 * (n // 3)
	if n % 3 == 2:
		anss += s1[0]
		anss += s1[1]
	if n % 3 == 1:
		anss += s1[0]
s1 = 'GRB'
cur = 0
for i in range(n):
	if s[i] != s1[i % 3]:
		cur += 1
if ans > cur:
	ans = cur
	anss = s1 * (n // 3)
	if n % 3 == 2:
		anss += s1[0]
		anss += s1[1]
	if n % 3 == 1:
		anss += s1[0]
s1 = 'GBR'
cur = 0
for i in range(n):
	if s[i] != s1[i % 3]:
		cur += 1
if ans > cur:
	ans = cur
	anss = s1 * (n // 3)
	if n % 3 == 2:
		anss += s1[0]
		anss += s1[1]
	if n % 3 == 1:
		anss += s1[0]
print(ans)
print(anss)


X = {'R', 'G', 'B'}

def comp(a, b):
	x = {a, b}
	t = list(X ^ x)
	return t[0]
N = int(input())
S = [i for i in input()]
if N == 1:
	print(0)
	print(''.join(S))
	exit()
count = 0
for i in range(N - 2):
	if S[i] == S[i + 1]:
		S[i + 1] = comp(S[i], S[i + 2])
		count += 1
if S[-1] == S[-2]:
	count += 1
	S[-1] = comp(S[-2], S[-2])
print(count)
print(''.join(S))


n = int(input())
t = input()
x = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
ans = [0] * 6
z = []
for i in range(6):
	y = x[i] * int(n / 3 + 2)
	for j in range(n):
		if y[j] != t[j]:
			ans[i] += 1
print(min(ans))
z = x[ans.index(min(ans))] * int(n / 3 + 2)
for k in range(n):
	print(z[k], end='')


import math as ma
import sys
from sys import exit
from decimal import Decimal as dec
from itertools import permutations

def li():
	return list(map(int, input().split()))

def num():
	return map(int, input().split())

def nu():
	return int(input())
mm = 1000000007
t = 1
for it in range(t):
	n = nu()
	s = input()
	x = ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']
	y = 999999999999
	pp = ''
	for i in range(6):
		ss = 0
		pq = ''
		for j in range(n):
			if x[i][j % 3] != s[j]:
				ss += 1
				pq += x[i][j % 3]
			else:
				pq += x[i][j % 3]
		if ss < y:
			pp = pq
			y = ss
	print(y)
	print(pp)


import sys
import math
amount = int(input())
string = input()
poss = ['RGB', 'RBG', 'BGR', 'BRG', 'GRB', 'GBR']
if len(string) == 1:
	print(0)
	print(string)
	sys.exit(0)
if len(string) == 2:
	if string == 'RR':
		print(1)
		print('RB')
		sys.exit(0)
	if string == 'BB':
		print(1)
		print('RB')
		sys.exit(0)
	if string == 'GG':
		print(1)
		print('GR')
		sys.exit(0)
	else:
		print(0)
		print(string)
		sys.exit(0)
min_err = 10000000000.0
ans = ''
for i in range(len(poss)):
	curr_err = 0
	string_2 = poss[i] * math.ceil(len(string) / 3)
	if len(string) % 3 == 0:
		string_2 = string_2[:len(string_2)]
	elif len(string) % 3 == 1:
		string_2 = string_2[:len(string_2) - 2]
	elif len(string) % 3 == 2:
		string_2 = string_2[:len(string_2) - 1]
	for i in range(len(string)):
		if string[i] != string_2[i]:
			curr_err += 1
	if curr_err < min_err:
		min_err = curr_err
		ans = string_2
print(min_err)
print(ans)


n = int(input())
s = input()
s1 = ('RGB' * (n // 3 + 1))[:n]
s2 = ('GBR' * (n // 3 + 1))[:n]
s3 = ('BRG' * (n // 3 + 1))[:n]
s4 = ('BGR' * (n // 3 + 1))[:n]
s5 = ('RBG' * (n // 3 + 1))[:n]
s6 = ('GRB' * (n // 3 + 1))[:n]
m1 = 0
m2 = 0
m3 = 0
m4 = 0
m5 = 0
m6 = 0
for i in range(n):
	if s[i] != s1[i]:
		m1 += 1
	if s[i] != s2[i]:
		m2 += 1
	if s[i] != s3[i]:
		m3 += 1
	if s[i] != s4[i]:
		m4 += 1
	if s[i] != s5[i]:
		m5 += 1
	if s[i] != s6[i]:
		m6 += 1
if m1 == min(m1, m2, m3, m4, m5, m6):
	print(m1)
	print(s1)
elif m2 == min(m1, m2, m3, m4, m5, m6):
	print(m2)
	print(s2)
elif m3 == min(m1, m2, m3, m4, m5, m6):
	print(m3)
	print(s3)
elif m4 == min(m1, m2, m3, m4, m5, m6):
	print(m4)
	print(s4)
elif m5 == min(m1, m2, m3, m4, m5, m6):
	print(m5)
	print(s5)
elif m6 == min(m1, m2, m3, m4, m5, m6):
	print(m6)
	print(s6)


t = input()
s = input()
s = list(s)
p = 0
r = 1
q = 2
change = 0
if len(s) > 1:
	while q < len(s):
		if s[r] == s[p]:
			if s[q] == s[p]:
				if s[q] == 'R':
					s[r] = 'B'
				elif s[q] == 'B':
					s[r] = 'G'
				elif s[q] == 'G':
					s[r] = 'R'
			elif s[p] == 'R' and s[q] == 'B':
				s[r] = 'G'
			elif s[p] == 'R' and s[q] == 'G':
				s[r] = 'B'
			elif s[p] == 'G' and s[q] == 'B':
				s[r] = 'R'
			elif s[p] == 'G' and s[q] == 'R':
				s[r] = 'B'
			elif s[p] == 'B' and s[q] == 'G':
				s[r] = 'R'
			elif s[p] == 'B' and s[q] == 'R':
				s[r] = 'G'
			change = change + 1
		p = p + 1
		q = q + 1
		r = r + 1
	if s[len(s) - 1] == s[len(s) - 2]:
		if s[len(s) - 1] == 'R':
			s[len(s) - 1] = 'G'
		elif s[len(s) - 1] == 'G':
			s[len(s) - 1] = 'B'
		elif s[len(s) - 1] == 'B':
			s[len(s) - 1] = 'R'
		change = change + 1
	result = ''
	for i in range(len(s)):
		result = result + s[i]
	print(change)
	print(result)
else:
	print(0)
	print(s[0])


n = int(input())
s = input()
check = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
m = 2 * 10 ** 5
x = ''
for comb in check:
	c = 0
	ans = ''
	ans += comb * (n // 3)
	ans += comb[:n % 3]
	for i in range(n):
		if s[i] != ans[i]:
			c += 1
	if c < m:
		m = c
		x = ans
print(m)
print(x)


a = int(input())
b = input()
c1 = 'RGB'
c2 = 'RBG'
c3 = 'BGR'
c4 = 'BRG'
c5 = 'GBR'
c6 = 'GRB'
for i in range(3, 200000):
	c1 += c1[i - 3]
	c2 += c2[i - 3]
	c3 += c3[i - 3]
	c4 += c4[i - 3]
	c5 += c5[i - 3]
	c6 += c6[i - 3]
ans1 = a
ans2 = a
ans3 = a
ans4 = a
ans5 = a
ans6 = a
for i in range(a):
	if b[i] == c1[i]:
		ans1 -= 1
	if b[i] == c2[i]:
		ans2 -= 1
	if b[i] == c3[i]:
		ans3 -= 1
	if b[i] == c4[i]:
		ans4 -= 1
	if b[i] == c5[i]:
		ans5 -= 1
	if b[i] == c6[i]:
		ans6 -= 1
ans7 = min(min(min(ans1, ans2), ans3), min(min(ans4, ans5), ans6))
if ans7 == ans1:
	print(ans7)
	print(c1[:a])
elif ans7 == ans2:
	print(ans7)
	print(c2[:a])
elif ans7 == ans3:
	print(ans7)
	print(c3[:a])
elif ans7 == ans4:
	print(ans7)
	print(c4[:a])
elif ans7 == ans5:
	print(ans7)
	print(c5[:a])
elif ans7 == ans6:
	print(ans7)
	print(c6[:a])


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from collections import Counter as C
(n,) = I()
k = 'RGB'
cost = 0
s = list(input()) + ['h'] * 2
for i in range(1, n):
	if s[i - 1] == s[i]:
		for j in range(3):
			if k[j] != s[i] and k[j] != s[i + 1]:
				s[i] = k[j]
				cost += 1
				break
print(cost)
print(''.join(s[:-2]))


t = int(input(''))
s = input('')
ss = []
cnt = 0
ii = 1
while ii < t:
	if s[ii] == s[ii - 1]:
		ss.append(ii)
		ii += 1
		cnt += 1
	ii += 1
j = 0
print(cnt)
for i in range(t):
	if j >= len(ss):
		print(s[i], end='')
		continue
	if i == ss[j]:
		if i != t - 1:
			if s[i - 1] == s[i + 1] and s[i - 1] == 'R':
				print('G', end='')
			elif s[i - 1] == s[i + 1] and s[i - 1] == 'G':
				print('B', end='')
			elif s[i - 1] == s[i + 1] and s[i - 1] == 'B':
				print('R', end='')
			elif s[i - 1] != s[i + 1] and s[i - 1] == 'B' and (s[i + 1] == 'R'):
				print('G', end='')
			elif s[i - 1] != s[i + 1] and s[i - 1] == 'R' and (s[i + 1] == 'B'):
				print('G', end='')
			elif s[i - 1] != s[i + 1] and s[i - 1] == 'B' and (s[i + 1] == 'G'):
				print('R', end='')
			elif s[i - 1] != s[i + 1] and s[i - 1] == 'G' and (s[i + 1] == 'B'):
				print('R', end='')
			elif s[i - 1] != s[i + 1] and s[i - 1] == 'G' and (s[i + 1] == 'R'):
				print('B', end='')
			elif s[i - 1] != s[i + 1] and s[i - 1] == 'R' and (s[i + 1] == 'G'):
				print('B', end='')
		if i == t - 1:
			if s[i - 1] == 'R':
				print('G', end='')
			elif s[i - 1] == 'G':
				print('B', end='')
			elif s[i - 1] == 'B':
				print('R', end='')
		j += 1
	else:
		print(s[i], end='')


l = ['RGB', 'RBG', 'GRB', 'GBR', 'BGR', 'BRG']
n = int(input())
s = input()
r = 10000000000
for i in range(6):
	a = l[i][0]
	b = l[i][1]
	c = l[i][2]
	v = 0
	for j in range(0, n, 3):
		if s[j] != a:
			v += 1
	for k in range(1, n, 3):
		if s[k] != b:
			v += 1
	for h in range(2, n, 3):
		if s[h] != c:
			v += 1
	if v < r:
		t = i
		r = v
print(r)
e = l[t] * (n // 3) + l[t][:n % 3]
print(e)


def dist(s1, s2):
	return len(list(filter(lambda _: s1[_] != s2[_], range(n))))
ss = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
n = int(input())
ss_n = [n // 3 * si + si[:n % 3] for si in ss]
s = input()
(k, a) = (n, s)
for ss_ni in ss_n:
	if dist(s, ss_ni) < k:
		k = dist(s, ss_ni)
		a = ss_ni
print(f'{k}\n{a}')


n = int(input())
s = input()
l = list(s)
cnt = 0

def check(a, b):
	s = 'BGR'
	for i in s:
		if i != a and i != b:
			return i

def chk(a):
	s = 'BGR'
	for i in s:
		if i != a:
			return i
for i in range(1, n):
	if l[i] == l[i - 1]:
		cnt += 1
		if i != n - 1:
			l[i] = check(l[i - 1], l[i + 1])
		else:
			l[i] = chk(l[i - 1])
print(cnt)
print(*l, sep='')


n = int(input())
a = list(input())
cou = 0
fuk = 0
for h in range(100):
	h = h + 1
if n == 1:
	fuk = 1
if n == 2:
	if a[0] == a[1]:
		cou += 1
		if a[0] == 'R':
			a[1] = 'G'
		elif a[1] == 'G':
			a[1] = 'R'
		else:
			a[1] = 'R'
	fuk = 1
for i in range(n - 2):
	if fuk == 1:
		break
	if a[i] == a[i + 1] and a[i + 1] == a[i + 2]:
		if a[i] == 'R':
			a[i + 1] = 'G'
		elif a[i] == 'G':
			a[i + 1] = 'R'
		else:
			a[i + 1] = 'R'
		cou += 1
for i in range(n - 1):
	if fuk == 1:
		break
	if a[i] == a[i + 1]:
		if i == 0:
			if a[i] == 'R' and a[i + 2] == 'B':
				a[i + 1] = 'G'
			elif a[i] == 'G' and a[i + 2] == 'R':
				a[i + 1] = 'B'
			elif a[i] == 'B' and a[i + 2] == 'G':
				a[i + 1] = 'R'
			elif a[i] == 'B' and a[i + 2] == 'R':
				a[i + 1] = 'G'
			elif a[i] == 'R' and a[i + 2] == 'G':
				a[i + 1] = 'B'
			else:
				a[i + 1] = 'R'
		elif a[i - 1] == 'R' and a[i + 1] == 'B':
			a[i] = 'G'
		elif a[i - 1] == 'G' and a[i + 1] == 'R':
			a[i] = 'B'
		elif a[i - 1] == 'B' and a[i + 1] == 'G':
			a[i] = 'R'
		elif a[i - 1] == 'B' and a[i + 1] == 'R':
			a[i] = 'G'
		elif a[i - 1] == 'R' and a[i + 1] == 'G':
			a[i] = 'B'
		else:
			a[i] = 'R'
		cou += 1
for h in range(100):
	h = h + 2
for h in range(100):
	h = h + 4
for h in range(100):
	h = h + 8
print(cou)
print(''.join(a))


n = int(input())
a = list(input())
import math
(a1, a2, a3, a4, a5, a6) = (['R', 'G', 'B'] * math.ceil(n / 3), ['G', 'R', 'B'] * math.ceil(n / 3), ['B', 'R', 'G'] * math.ceil(n / 3), ['R', 'B', 'G'] * math.ceil(n / 3), ['G', 'B', 'R'] * math.ceil(n / 3), ['B', 'G', 'R'] * math.ceil(n / 3))
(a1, a2, a3, a4, a5, a6) = (a1[:n], a2[:n], a3[:n], a4[:n], a5[:n], a6[:n])
(s1, s2, s3, s4, s5, s6) = (0, 0, 0, 0, 0, 0)
for i in range(n):
	if a[i] != a1[i]:
		s1 += 1
for i in range(n):
	if a[i] != a2[i]:
		s2 += 1
for i in range(n):
	if a[i] != a3[i]:
		s3 += 1
for i in range(n):
	if a[i] != a4[i]:
		s4 += 1
for i in range(n):
	if a[i] != a5[i]:
		s5 += 1
for i in range(n):
	if a[i] != a6[i]:
		s6 += 1
s = min(s1, s2, s3, s4, s5, s6)
print(s)
if s == s1:
	print(''.join(a1))
elif s == s2:
	print(''.join(a2))
elif s == s3:
	print(''.join(a3))
elif s == s4:
	print(''.join(a4))
elif s == s5:
	print(''.join(a5))
elif s == s6:
	print(''.join(a6))


n = int(input())
D = [*input()]
A = [] + D
a = 0
B = [] + D
b = 0
for i in range(1, n - 1):
	if A[i - 1] == A[i] == A[i + 1]:
		if A[i] == 'B':
			A[i] = 'G'
		elif A[i] == 'G':
			A[i] = 'B'
		else:
			A[i] = 'G'
		a += 1
	if B[i - 1] == B[i] == B[i + 1]:
		if B[i] == 'B':
			B[i] = 'G'
		elif B[i] == 'G':
			B[i] = 'B'
		else:
			B[i] = 'G'
		b += 1
for i in range(n - 1):
	if A[i] != A[i + 1]:
		continue
	elif i == 0:
		if A[i] == 'R':
			A[i] = 'G'
		elif A[i] == 'B':
			A[i] = 'R'
		else:
			A[i] = 'B'
		a += 1
	else:
		if [A[i - 1], A[i + 1]] == ['R', 'R']:
			A[i] = 'B'
		elif [A[i - 1], A[i + 1]] == ['B', 'B']:
			A[i] = 'R'
		elif [A[i - 1], A[i + 1]] == ['G', 'G']:
			A[i] = 'R'
		elif [A[i - 1], A[i + 1]] == ['R', 'B']:
			A[i] = 'G'
		elif [A[i - 1], A[i + 1]] == ['R', 'G']:
			A[i] = 'B'
		elif [A[i - 1], A[i + 1]] == ['B', 'R']:
			A[i] = 'G'
		elif [A[i - 1], A[i + 1]] == ['B', 'G']:
			A[i] = 'R'
		elif [A[i - 1], A[i + 1]] == ['G', 'R']:
			A[i] = 'B'
		elif [A[i - 1], A[i + 1]] == ['G', 'B']:
			A[i] = 'R'
		a += 1
for i in range(1, n):
	if i == n - 1:
		if B[i - 1] == B[i]:
			if B[i - 1] == 'R':
				B[i] = 'B'
			elif B[i - 1] == 'G':
				B[i] = 'B'
			else:
				B[i] = 'G'
			b += 1
	elif B[i - 1] == B[i]:
		if [B[i - 1], B[i + 1]] == ['R', 'R']:
			B[i] = 'B'
		elif [B[i - 1], B[i + 1]] == ['B', 'B']:
			B[i] = 'G'
		elif [B[i - 1], B[i + 1]] == ['G', 'G']:
			B[i] = 'B'
		elif [B[i - 1], B[i + 1]] == ['R', 'B']:
			B[i] = 'G'
		elif [B[i - 1], B[i + 1]] == ['R', 'G']:
			B[i] = 'B'
		elif [B[i - 1], B[i + 1]] == ['B', 'R']:
			B[i] = 'G'
		elif [B[i - 1], B[i + 1]] == ['B', 'G']:
			B[i] = 'R'
		elif [B[i - 1], B[i + 1]] == ['G', 'R']:
			B[i] = 'B'
		else:
			B[i] = 'G'
		b += 1
if a <= b:
	print(a)
	print(''.join(A))
else:
	print(b)
	print(''.join(B))


n = int(input())
a = []
a = [x for x in input()]
b = []
c = []
count = 0
for i in a:
	c.append(i)
color = ['R', 'G', 'B']
i = 0
while i < n:
	if n == 1:
		break
	b = []
	if i != n - 1 and i != n - 2 and (a[i] == a[i + 1] == a[i + 2]):
		b.append(a[i])
		for j in color:
			if j not in b:
				a[i + 1] = j
				i += 1
				break
	elif i == 0:
		if a[i + 1] == a[i]:
			b.append(a[i + 1])
			for j in color:
				if j not in b:
					a[i] = j
					break
	elif i == n - 1:
		if a[i - 1] == a[i]:
			b.append(a[i - 1])
			for j in color:
				if j not in b:
					a[i] = j
					break
	elif a[i + 1] == a[i] or a[i - 1] == a[i]:
		b.append(a[i + 1])
		b.append(a[i - 1])
		for j in color:
			if j not in b:
				a[i] = j
				break
	i += 1
for i in range(n):
	if c[i] != a[i]:
		count += 1
print(count)
for i in a:
	print(i, end='')


def main():
	n = int(input())
	clone = set(['R', 'G', 'B'])
	lamps = [i for i in input()]
	c = 0
	for i in range(len(lamps) - 1):
		if lamps[i] == lamps[i + 1] and i != len(lamps) - 2:
			t = clone - set([lamps[i], lamps[i + 2]])
			lamps[i + 1] = t.pop()
			c += 1
		if lamps[i] == lamps[i + 1] and i == len(lamps) - 2:
			t = clone - set([lamps[i]])
			lamps[i + 1] = t.pop()
			c += 1
	print(c)
	print(''.join(lamps))
main()


def dis(s, t):
	dis = 0
	for i in range(len(s)):
		dis += s[i] != t[i]
	return dis
n = int(input())
m = input()
if n > 2:
	s = ['RGB', 'RBG', 'BGR', 'BRG', 'GRB', 'GBR']
	(ans, st) = (dis(m, s[0] * n), (s[0] * n)[:n])
	for i in s[1:]:
		d = dis(m, i * n)
		if d < ans:
			ans = d
			st = (i * n)[:n]
	print(ans)
	print(st)
elif n == 1:
	print(0)
	print(m)
elif m[0] != m[1]:
	print(0)
	print(m)
else:
	print(1)
	print(m[0] + ('R' if m[0] != 'R' else 'G'))


n = int(input())
s = list(' ' + input() + ' ')
c = 0
for i in range(1, n + 1):
	if s[i] == s[i - 1]:
		c += 1
		for z in 'RGB':
			if z != s[i - 1] and z != s[i + 1]:
				s[i] = z
				break
print(c)
print(''.join(s[1:-1]))


n = int(input())
s = input() + '00'
mas = []
for i in range(len(s)):
	mas.append(s[i])
s = mas
ans = 0
for i in range(n - 1):
	if s[i] == s[i + 1]:
		if s[i + 2] == '0':
			if s[i + 1] == 'R':
				s[i + 1] = 'B'
			else:
				s[i + 1] = 'R'
			ans += 1
			break
		elif s[i] != s[i + 2]:
			s[i + 1] = chr(ord('R') + ord('G') + ord('B') - ord(s[i + 1]) - ord(s[i + 2]))
			ans += 1
		else:
			if s[i + 1] == 'R':
				s[i + 1] = 'B'
			else:
				s[i + 1] = 'R'
			ans += 1
print(ans)
for i in s[0:-2]:
	print(i, end='')


def divGar(s, n):
	s = list(s)
	i = 0
	c = 0
	while i < n - 1:
		g = ['R', 'G', 'B']
		if s[i] == s[i + 1]:
			if i + 2 < n:
				g.remove(s[i + 2])
			if s[i] in g:
				g.remove(s[i])
			s[i + 1] = g[0]
			c += 1
		i += 1
	s = ''.join(s)
	return (c, s)
n = int(input())
s = input()
(c, s) = divGar(s, n)
print(c)
print(s)


n = int(input())
s = list(input())
ans = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		se = {'R', 'G', 'B'}
		se.discard(s[i])
		if i < n - 1:
			se.discard(s[i + 1])
		s[i] = list(se)[0]
		ans += 1
print(ans)
print(''.join(s))


import sys
from bisect import bisect_left, bisect_right
from collections import deque, Counter
from math import gcd, sqrt, factorial, ceil, log
from itertools import permutations
inf = float('inf')
mod = 1000000007
mini = 1000000007

def fact(n):
	if n == 0:
		return 1
	p = 1
	d = 10 ** 9 + 7
	for i in range(1, n + 1):
		p = p * i
		p = p % d
	return p

def ncr(n, r):
	d = 10 ** 9 + 7
	num = fact(n)
	den = fact(r) * fact(n - r) % d
	den = pow(den, d - 2, d)
	return num * den % d

def sieve(n):
	prime = [True for i in range(n + 1)]
	lst = [0] * (n + 1)
	p = 2
	while p * p <= n:
		if prime[p]:
			lst[p] = p
			for i in range(p * p, n + 1, p):
				if prime[i] == True:
					prime[i] = False
					lst[i] = p
		p = p + 1
	for i in range(1, n + 1):
		if lst[i] == 0:
			lst[i] = i
	mylist = [0] * (n + 1)
	for i in range(2, n + 1):
		mylist[lst[i]] = mylist[lst[i]] + 1
	return mylist

def binary(number):
	result = 0
	while number:
		result = result + 1
		number = number & number - 1
	return result

def calculate_factors(n):
	hh = [1] * (n + 1)
	p = 2
	while p * p < n:
		if hh[p] == 1:
			for i in range(p * 2, n, p):
				hh[i] = 0
		p += 1
	total = 1
	for p in range(2, n + 1):
		if hh[p] == 1:
			count = 0
			if n % p == 0:
				while n % p == 0:
					n = int(n / p)
					count += 1
				total *= count + 1
	return total

def prime_factors(n):
	i = 2
	factors = set()
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.add(i)
	if n > 1:
		factors.add(n)
	if len(factors) == 2:
		return True
	else:
		return False

def isPrime(n):
	if n == 2 or n == 3:
		return True
	if n % 2 == 0 or n < 2:
		return False
	for i in range(3, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
string = input()
result = []
count = 0
result.append(string[0])
for i in range(1, n):
	if string[i] != result[i - 1]:
		result.append(string[i])
	elif string[i] == result[i - 1] and i == n - 1:
		if result[i - 1] == 'G':
			result.append('R')
		elif result[i - 1] == 'B':
			result.append('R')
		else:
			result.append('G')
	elif string[i] == result[i - 1] and i != n - 1:
		if string[i] == 'R' and string[i + 1] == 'G':
			result.append('B')
		elif string[i] == 'R' and string[i + 1] == 'B':
			result.append('G')
		elif string[i] == 'G' and string[i + 1] == 'B':
			result.append('R')
		elif string[i] == 'G' and string[i + 1] == 'R':
			result.append('B')
		elif string[i] == 'B' and string[i + 1] == 'G':
			result.append('R')
		elif string[i] == 'B' and string[i + 1] == 'R':
			result.append('G')
		elif string[i] == 'R' and string[i + 1] == 'R':
			result.append('G')
		elif string[i] == 'B' and string[i + 1] == 'B':
			result.append('R')
		elif string[i] == 'G' and string[i + 1] == 'G':
			result.append('B')
for i in range(n):
	if string[i] != result[i]:
		count = count + 1
print(count)
print(''.join(result))


n = int(input())
s = input()
s = [s[i] for i in range(n)]
ans = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		ans += 1
		temp = ['R', 'G', 'B']
		temp.remove(s[i - 1])
		if i + 1 < n and s[i + 1] in temp:
			temp.remove(s[i + 1])
		s[i] = temp[0]
print(ans)
print(''.join((str(x) for x in s)))


n = int(input())
s = input()
if n == 1:
	print(0)
	print(s)
else:
	A = [[0] * 3 for i in range(n)]
	Aid = [[0] * 3 for i in range(n)]
	M = {'R': 0, 'G': 1, 'B': 2}
	M_ = {0: 'R', 1: 'G', 2: 'B'}
	v = M[s[0]]
	A[0][(v + 1) % 3] = 1
	A[0][(v + 2) % 3] = 1

	def whichmax(A, id):
		if A[id][0] <= A[id][1] and A[id][0] <= A[id][2]:
			return 0
		if A[id][1] <= A[id][0] and A[id][1] <= A[id][2]:
			return 1
		return 2

	def min_and_id(a, ida, b, idb):
		if a < b:
			return (a, ida)
		else:
			return (b, idb)
	for i in range(1, n):
		v = M[s[i]]
		vo0 = A[i - 1][v]
		vo1 = A[i - 1][(v + 1) % 3]
		vo2 = A[i - 1][(v + 2) % 3]
		(val, vid) = min_and_id(vo1, (v + 1) % 3, vo2, (v + 2) % 3)
		A[i][v] = val
		Aid[i][v] = vid
		(val2, vid2) = min_and_id(vo0, v, vo2, (v + 2) % 3)
		A[i][(v + 1) % 3] = val2 + 1
		Aid[i][(v + 1) % 3] = vid2
		(val3, vid3) = min_and_id(vo0, v, vo1, (v + 1) % 3)
		A[i][(v + 2) % 3] = val3 + 1
		Aid[i][(v + 2) % 3] = vid3
	ans = ''
	i = n - 1
	midx = whichmax(A, n - 1)
	pid = midx
	while i >= 0:
		ans += M_[pid]
		pid = Aid[i][pid]
		i -= 1
	print(A[n - 1][midx])
	print(ans[::-1])


n = int(input())
s = input()
possible = ['RGB', 'RBG', 'BGR', 'BRG', 'GBR', 'GRB']
count = [0] * 6
for i in range(6):
	possible[i] = possible[i] * (n // 3) + possible[i][:n % 3]
for i in range(6):
	for j in range(n):
		if possible[i][j] != s[j]:
			count[i] += 1
print(min(count))
print(possible[count.index(min(count))])


n = int(input())
s = input()
c = ['RGB', 'RBG', 'GBR', 'GRB', 'BRG', 'BGR']
v = {0: 'R', 1: 'G', 2: 'B'}
v_ = {'R': 0, 'G': 1, 'B': 2}
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if s[0] == s[1]:
		print(1)
		print(s[0] + v[(v_[s[0]] + 1) % 3])
	else:
		print(0)
		print(s)
elif n == 3:
	if s[0] == s[1] == s[2]:
		print(2)
		print(s[0] + v[(v_[s[0]] + 1) % 3] + v[(v_[s[0]] + 2) % 3])
	else:
		me = 3
		ans = ''
		for i in c:
			e = 0
			for i_ in range(3):
				if i[i_] != s[i_]:
					e += 1
			if me >= e:
				ans = i
				me = e
		print(me)
		print(ans)
else:

	def rep(id, s):
		n = len(s)
		s_ = ''
		n_ = 0
		while n_ <= n:
			s_ = s_ + c[id]
			n_ += 3
		snew = s_[0:n]
		e = 0
		for i in range(0, n):
			if s[i] != snew[i]:
				e += 1
		return (e, snew)
	me = 10000000
	ans = ''
	for i in range(len(c)):
		(ev, ansnew) = rep(i, s)
		if ev < me:
			me = ev
			ans = ansnew
	print(me)
	print(ans)


n = int(input())
s = input()
rgb = n
rbg = n
grb = n
gbr = n
brg = n
bgr = n
for i in range(n):
	if i % 3 == 0:
		if s[i] == 'R':
			rgb -= 1
			rbg -= 1
		elif s[i] == 'G':
			grb -= 1
			gbr -= 1
		else:
			brg -= 1
			bgr -= 1
	elif i % 3 == 1:
		if s[i] == 'R':
			grb -= 1
			brg -= 1
		elif s[i] == 'G':
			rgb -= 1
			bgr -= 1
		else:
			rbg -= 1
			gbr -= 1
	elif s[i] == 'R':
		gbr -= 1
		bgr -= 1
	elif s[i] == 'G':
		rbg -= 1
		brg -= 1
	else:
		rgb -= 1
		grb -= 1
sml = min([rgb, rbg, grb, gbr, brg, bgr])
print(sml)
if rgb == sml:
	print('RGB' * (n // 3) + 'RGB'[:n % 3])
elif rbg == sml:
	print('RBG' * (n // 3) + 'RBG'[:n % 3])
elif grb == sml:
	print('GRB' * (n // 3) + 'GRB'[:n % 3])
elif gbr == sml:
	print('GBR' * (n // 3) + 'GBR'[:n % 3])
elif brg == sml:
	print('BRG' * (n // 3) + 'BRG'[:n % 3])
else:
	print('BGR' * (n // 3) + 'BGR'[:n % 3])


input()
lamps = list(input())
res = 0
for i in range(len(lamps) - 1):
	if lamps[i] == lamps[i + 1]:
		if i == len(lamps) - 2:
			if lamps[i] != 'B':
				lamps[i + 1] = 'B'
			else:
				lamps[i + 1] = 'R'
		elif lamps[i] == 'B':
			if lamps[i + 2] != 'R':
				lamps[i + 1] = 'R'
			else:
				lamps[i + 1] = 'G'
		elif lamps[i] == 'G':
			if lamps[i + 2] != 'R':
				lamps[i + 1] = 'R'
			else:
				lamps[i + 1] = 'B'
		elif lamps[i + 2] != 'B':
			lamps[i + 1] = 'B'
		else:
			lamps[i + 1] = 'G'
		res += 1
print(res)
res = ''
for i in lamps:
	res += str(i)
print(res)


n = int(input())
s = input()
l = list(s)
ans = 0
for i in range(1, n):
	if l[i] == l[i - 1]:
		if l[i] == 'R':
			if i + 1 == n:
				l[i] = 'G'
				ans += 1
			if i + 1 < n and l[i + 1] == 'R':
				l[i] = 'G'
				ans += 1
			elif i + 1 < n and l[i + 1] == 'G':
				l[i] = 'B'
				ans += 1
			elif i + 1 < n and l[i + 1] == 'B':
				l[i] = 'G'
				ans += 1
		elif l[i] == 'G':
			if i + 1 == n:
				l[i] = 'B'
				ans += 1
			if i + 1 < n and l[i + 1] == 'R':
				l[i] = 'B'
				ans += 1
			elif i + 1 < n and l[i + 1] == 'G':
				l[i] = 'B'
				ans += 1
			elif i + 1 < n and l[i + 1] == 'B':
				l[i] = 'R'
				ans += 1
		elif l[i] == 'B':
			if i + 1 == n:
				l[i] = 'G'
				ans += 1
			if i + 1 < n and l[i + 1] == 'R':
				l[i] = 'G'
				ans += 1
			elif i + 1 < n and l[i + 1] == 'G':
				l[i] = 'R'
				ans += 1
			elif i + 1 < n and l[i + 1] == 'B':
				l[i] = 'G'
				ans += 1
print(ans)
for i in l:
	print(i, end='')


n = int(input())
s = input().strip()
ans = str(s[0])
cnt = 0
for i in range(1, n):
	if s[i] == ans[i - 1]:
		for c in ['R', 'G', 'B']:
			if c != ans[i - 1] and (i == n - 1 or c != s[i + 1]):
				ans += str(c)
				cnt += 1
				break
	else:
		ans += str(s[i])
print(cnt)
print(ans)


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return lires(mi())
n = ii()
s = list(input())
res = ''
for i in range(n):
	res += s[i]
for i in range(1, n):
	if s[i] == s[i - 1] and i != n - 1:
		if s[i] == 'R':
			if s[i + 1] != 'B':
				s[i] = 'B'
			else:
				s[i] = 'G'
		elif s[i] == 'B':
			if s[i + 1] != 'G':
				s[i] = 'G'
			else:
				s[i] = 'R'
		elif s[i] == 'G':
			if s[i + 1] != 'R':
				s[i] = 'R'
			else:
				s[i] = 'B'
		continue
	if s[i] == s[i - 1] and i == n - 1:
		if s[i - 1] == 'R':
			s[i] = 'G'
		else:
			s[i] = 'R'
cnt = 0
for i in range(n):
	if s[i] != res[i]:
		cnt += 1
print(cnt)
print(''.join(s))


n = int(input())
x = input()
p1 = 'RGB'
p2 = 'RBG'
p3 = 'GBR'
p4 = 'BGR'
p5 = 'GRB'
p6 = 'BRG'
p = [p1, p2, p3, p4, p5, p6]
an = [0, 0, 0, 0, 0, 0]
for i in range(n):
	if x[i] != p1[i % 3]:
		an[0] += 1
	if x[i] != p2[i % 3]:
		an[1] += 1
	if x[i] != p3[i % 3]:
		an[2] += 1
	if x[i] != p4[i % 3]:
		an[3] += 1
	if x[i] != p5[i % 3]:
		an[4] += 1
	if x[i] != p6[i % 3]:
		an[5] += 1
ans = p[an.index(min(an))] * (n // 3 + 1)
print(min(an))
print(ans[:n])


def check_to_mask(mask):
	global s
	global ans
	c = ''
	cnt = 0
	for i in range(len(s)):
		c = mask[int(i) % 3]
		if str(s[int(i)]) != str(c):
			cnt += 1
	if cnt < ans:
		ans = cnt
		global aans
		aans = mask
	return cnt
n = int(input())
s = input()
smp1 = 'RGB'
smp2 = 'GRB'
smp3 = 'BGR'
smp4 = 'RBG'
smp5 = 'GBR'
smp6 = 'BRG'
aans = ''
ans = int(len(s))
ans = min(ans, int(check_to_mask(smp1)))
ans = min(ans, check_to_mask(smp2))
ans = min(ans, check_to_mask(smp3))
ans = min(ans, check_to_mask(smp4))
ans = min(ans, check_to_mask(smp5))
ans = min(ans, check_to_mask(smp6))
print(ans)
for i in range(len(s)):
	print(aans[i % 3], end='')


n = int(input())
a = [ord(i) for i in input()]
if n == 1:
	print(0)
	for i in a:
		print(chr(i))
elif n == 2:
	if len(set(a)) == 1:
		print(1)
		print(chr(a[0]), end='')
		if a[0] == 66:
			print(chr(82))
		elif a[0] == 82:
			print(chr(66))
		else:
			print(chr(66))
	else:
		print(chr(a[0]), chr(a[1]), sep='')
else:
	ans = a.copy()
	mn = n
	b = [82, 71, 66] * (n // 3)
	if n % 3 == 1:
		b.append(b[0])
	elif n % 3 == 2:
		b.append(b[0])
		b.append(b[1])
	k = 0
	for i in range(n):
		if a[i] != b[i]:
			k += 1
	if k < mn:
		mn = k
		ans = b[:]
	b = [82, 66, 71] * (n // 3)
	if n % 3 == 1:
		b.append(b[0])
	elif n % 3 == 2:
		b.append(b[0])
		b.append(b[1])
	k = 0
	for i in range(n):
		if a[i] != b[i]:
			k += 1
	if k < mn:
		mn = k
		ans = b[:]
	b = [66, 82, 71] * (n // 3)
	k = 0
	if n % 3 == 1:
		b.append(b[0])
	elif n % 3 == 2:
		b.append(b[0])
		b.append(b[1])
	for i in range(n):
		if a[i] != b[i]:
			k += 1
	if k < mn:
		mn = k
		ans = b[:]
	b = [66, 71, 82] * (n // 3)
	k = 0
	if n % 3 == 1:
		b.append(b[0])
	elif n % 3 == 2:
		b.append(b[0])
		b.append(b[1])
	for i in range(n):
		if a[i] != b[i]:
			k += 1
	if k < mn:
		mn = k
		ans = b[:]
	b = [71, 66, 82] * (n // 3)
	k = 0
	if n % 3 == 1:
		b.append(b[0])
	elif n % 3 == 2:
		b.append(b[0])
		b.append(b[1])
	for i in range(n):
		if a[i] != b[i]:
			k += 1
	if k < mn:
		mn = k
		ans = b[:]
	b = [71, 82, 66] * (n // 3)
	k = 0
	if n % 3 == 1:
		b.append(b[0])
	elif n % 3 == 2:
		b.append(b[0])
		b.append(b[1])
	for i in range(n):
		if a[i] != b[i]:
			k += 1
	if k < mn:
		mn = k
		ans = b[:]
	print(mn)
	for i in ans:
		print(chr(i), end='')
	print()


input()
s = input()

def cost(p, s):
	return sum((1 for (i, x) in enumerate(p) if len(s) - 1 >= i and x != s[i]))

def solve(s):
	best = 10 ** 9
	bestPattern = None
	for pattern in ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']:
		currentCost = 0
		for i in range(0, len(s), 3):
			currentCost += cost(pattern, s[i:i + 3])
		if currentCost < best:
			best = currentCost
			bestPattern = pattern
	return (best, bestPattern * (len(s) // 3) + bestPattern[:len(s) % 3])
ans = solve(s)
print(ans[0], ans[1])


n = int(input())
s = input()
l = ['RGB', 'RBG', 'GRB', 'GBR', 'BGR', 'BRG']
ans = n
res = ''
for j in l:
	tempans = 0
	for i in range(n):
		if s[i] != j[i % 3]:
			tempans += 1
	if tempans < ans:
		ans = tempans
		res = j
print(ans)
res2 = ''
for i in range(n):
	res2 += res[i % 3]
print(res2)


def diff_string(s1, s2):
	count = 0
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			count = count + 1
	return count

def generate_string(prefix, n):
	num_prefix = int(n / 3)
	s = prefix * num_prefix
	r = n % 3
	if r > 0:
		s = s + s[0:r]
	return s

def generate_strings(n):
	prefixes = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
	return [generate_string(prefixes[i], n) for i in range(len(prefixes))]
n = int(input())
s = input()
if len(s) == 1:
	print(0)
	print(s)
elif len(s) == 2:
	ls = ['RG', 'RB', 'GR', 'GB', 'BR', 'BG']
	ld = [diff_string(s, ls[i]) for i in range(len(ls))]
	m = min(ld)
	p = ld.index(m)
	print(m)
	print(ls[p])
else:
	ls = generate_strings(len(s))
	ld = [diff_string(s, ls[i]) for i in range(len(ls))]
	m = min(ld)
	p = ld.index(m)
	print(m)
	print(ls[p])


import sys
input = sys.stdin.readline
from math import ceil, floor, factorial

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
n = int(input())
s = list(input().strip())
ans = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		ans += 1
		s[i] = (set('RGB') - set(s[i:i + 2])).pop()
print(ans)
print(''.join(s))


def minpos(f):
	mini = 1000000
	minpos = 0
	for i in range(len(f)):
		if f[i] < mini:
			mini = f[i]
			minpos = i
	return minpos

def diff(a, b, n):
	d = 0
	for i in range(n):
		if a[i] != b[i]:
			d += 1
	return d
n = int(input())
s = input()
al = 'RGB'
bl = 'RBG'
cl = 'BRG'
dl = 'BGR'
el = 'GRB'
fl = 'GBR'
a = ''
b = ''
c = ''
d = ''
e = ''
f = ''
for i in range(n):
	a += al[i % 3]
	b += bl[i % 3]
	c += cl[i % 3]
	d += dl[i % 3]
	e += el[i % 3]
	f += fl[i % 3]
fi = []
fi.append(diff(a, s, n))
fi.append(diff(b, s, n))
fi.append(diff(c, s, n))
fi.append(diff(d, s, n))
fi.append(diff(e, s, n))
fi.append(diff(f, s, n))
m = minpos(fi)
if m == 0:
	print(fi[m])
	print(a)
if m == 1:
	print(fi[m])
	print(b)
if m == 2:
	print(fi[m])
	print(c)
if m == 3:
	print(fi[m])
	print(d)
if m == 4:
	print(fi[m])
	print(e)
if m == 5:
	print(fi[m])
	print(f)


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())
s = str(input())
s_ = []
r = [[], [], []]
g = [[], [], []]
b = [[], [], []]
for i in range(n):
	s_.append(s[i])
	if s[i] == 'R':
		if i % 3 == 0:
			r[0].append(i)
		elif i % 3 == 1:
			r[1].append(i)
		else:
			r[2].append(i)
	elif s[i] == 'G':
		if i % 3 == 0:
			g[0].append(i)
		elif i % 3 == 1:
			g[1].append(i)
		else:
			g[2].append(i)
	if s[i] == 'B':
		if i % 3 == 0:
			b[0].append(i)
		elif i % 3 == 1:
			b[1].append(i)
		else:
			b[2].append(i)
lon = len(r[0]) + len(g[1]) + len(b[2])
cache = '012'
for i in range(3):
	for j in range(3):
		if j != i:
			for k in range(3):
				if k != i and k != j:
					if len(r[i]) + len(g[j]) + len(b[k]) > lon:
						lon = len(r[i]) + len(g[j]) + len(b[k])
						cache = str(i) + str(j) + str(k)
print(n - lon)
dic = {cache[0]: 'R', cache[1]: 'G', cache[2]: 'B'}
for i in range(n):
	j = i % 3
	s_[i] = dic[str(j)]
	print(s_[i], end='')


n = int(input())
c = input()
mi = 1000000
b = ['BGR', 'BRG', 'GBR', 'GRB', 'RBG', 'RGB']
for k in b:
	a = ''
	q = int(n / 3)
	r = int(n) % 3
	for p in range(q):
		a += k
	if r == 1:
		a += k[0]
	elif r == 2:
		a += k[0] + k[1]
	ct = 0
	for p in range(n):
		if c[p] != a[p]:
			ct += 1
	if ct < mi:
		mi = ct
		d = a
print(mi)
print(d)


input()
a = list(input())
d = set('RGB')
c = 0
for i in range(1, len(a)):
	if a[i] == a[i - 1]:
		a[i] = list(d - set(a[i:i + 2]))[0]
		c += 1
print(c)
print(''.join(a))


t = 1
j = 0
for i in range(10):
	j += 1
for _ in range(t):
	n = int(input())
	s = list(input())
	st = ''
	for i in range(n):
		st += s[i]
	for i in range(1, n):
		if s[i] == s[i - 1] and i != n - 1:
			if s[i] == 'R':
				if s[i + 1] != 'B':
					s[i] = 'B'
				else:
					s[i] = 'G'
			elif s[i] == 'G':
				if s[i + 1] != 'R':
					s[i] = 'R'
				else:
					s[i] = 'B'
			elif s[i] == 'B':
				if s[i + 1] != 'G':
					s[i] = 'G'
				else:
					s[i] = 'R'
			continue
		if s[i] == s[i - 1] and i == n - 1:
			if s[i - 1] == 'R':
				s[i] = 'G'
			else:
				s[i] = 'R'
	c = 0
	for i in range(n):
		if s[i] != st[i]:
			c += 1
	print(c)
	print(''.join(s))


import sys
import math
n = int(input())
s = input()
if n > 1:
	if s[-1] == 'R':
		s += 'G'
	elif s[-1] == 'G':
		s += 'B'
	elif s[-1] == 'B':
		s += 'R'
	final = []
	count = 1
	change = 0
	for i in range(1, n + 1):
		if s[i] == s[i - 1]:
			count += 1
		elif s[i] != s[i - 1]:
			if count == 1:
				final.append(s[i - 1])
			elif count > 1:
				if count % 2 == 0:
					if s[i - 1] == 'R':
						if s[i] == 'G':
							cur = 'B'
						if s[i] == 'B':
							cur = 'G'
					elif s[i - 1] == 'G':
						if s[i] == 'B':
							cur = 'R'
						if s[i] == 'R':
							cur = 'B'
					elif s[i - 1] == 'B':
						if s[i] == 'R':
							cur = 'G'
						if s[i] == 'G':
							cur = 'R'
					for j in range(count):
						if j % 2 == 0:
							final.append(s[i - 1])
						else:
							final.append(cur)
							change += 1
				else:
					if s[i - 1] == 'R':
						cur = 'G'
					elif s[i - 1] == 'G':
						cur = 'B'
					elif s[i - 1] == 'B':
						cur = 'R'
					for j in range(count):
						if j % 2 == 0:
							final.append(s[i - 1])
						else:
							final.append(cur)
							change += 1
			count = 1
	print(change)
	print(''.join(final))
elif n == 1:
	print(0)
	print(s[0])


import re, math, decimal, bisect, collections

def read():
	return input().strip()

def iread():
	return int(input().strip())

def viread():
	return [int(_) for _ in input().strip().split()]
n = iread()
string = list(read())
ans = 0
chars = ['R', 'B', 'G']
for i in range(n - 1):
	if string[i] == string[i + 1]:
		ans += 1
		if i + 2 < n:
			for c in chars:
				if string[i] != c and string[i + 2] != c:
					string[i + 1] = c
		else:
			for c in chars:
				if string[i] != c:
					string[i + 1] = c
print(ans)
print(''.join(string))


from sys import stdin, stdout
for _ in range(1):
	n = int(stdin.readline())
	s = input() + ' '
	ans = list(s)
	p = 0
	while p < n:
		r = p + 1
		while r < n and s[r] == s[p]:
			r += 1
		for ch in 'RGB':
			if ch != s[p] and ch != s[r]:
				place = ch
				break
		for i in range(p + 1, r, 2):
			ans[i] = place
		p = r
	print(sum((int(ch != ch1) for (ch, ch1) in zip(s, ans))))
	print(''.join(ans))


n = int(input())
s = list(input())
i = 0
ans = 0
while i < n - 1:
	j = i
	while j + 1 < n and s[j + 1] == s[i]:
		j += 1
	k = j - i + 1
	k /= 2
	ans += int(k)
	i = j + 1
i = 1
while i < n - 1:
	if s[i] == s[i - 1]:
		s[i] = 'R'
		if s[i - 1] == s[i] or s[i + 1] == s[i]:
			s[i] = 'G'
			if s[i - 1] == s[i] or s[i + 1] == s[i]:
				s[i] = 'B'
	i += 1
if n >= 2:
	if s[n - 1] == s[n - 2]:
		s[n - 1] = 'R'
		if s[n - 2] == 'R':
			s[n - 1] = 'G'
print(ans)
se = ''
i = 0
while i < n:
	se += s[i]
	i += 1
print(se)


n = int(input())
s = input() + 'Q'
t = s[0]
pre = s[0]
d = ['R', 'G', 'B']
num = 0
for i in range(1, len(s) - 1):
	if pre == s[i]:
		num += 1
		if s[i] == s[i + 1]:
			for j in range(3):
				if pre != d[j]:
					t += d[j]
					break
		else:
			for j in range(3):
				if pre != d[j] and s[i + 1] != d[j]:
					t += d[j]
					break
		pre = t[-1]
	else:
		t += s[i]
		pre = s[i]
print(num)
print(t)


from itertools import combinations
from sys import stdin, stdout

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def swap(ans, s):
	if ans[i - 1] == 'R':
		if s[i + 1] == 'G':
			ans[i] = 'B'
		else:
			ans[i] = 'G'
	elif ans[i - 1] == 'B':
		if s[i + 1] == 'R':
			ans[i] = 'G'
		else:
			ans[i] = 'R'
	elif s[i + 1] == 'B':
		ans[i] = 'R'
	else:
		ans[i] = 'B'
n = intIn()
s = stdin.readline()
if n == 1:
	print(0)
	print(s)
	exit(0)
if n == 2:
	if s[0] != s[1]:
		print(0)
		print(s)
		exit(0)
	else:
		print(1)
		if s[0] == 'R':
			print('RG')
		elif s[0] == 'G':
			print('GB')
		else:
			print('BR')
	exit(0)
s = list(s)
ans = s
cnt = 0
colors = 'RGB'
perms = ['RGB', 'RBG', 'GBR', 'GRB', 'BGR', 'BRG']
ans = ['000']
for i in range(6):
	temp = perms[i] * (n // 3) + perms[i][:n % 3]
	ans.append(temp)
carr = [0] * 7
for i in range(n):
	for j in range(1, 7):
		if s[i] != ans[j][i]:
			carr[j] += 1
cnt = min(carr[1:])
idx = carr.index(cnt)
print(cnt)
print(''.join(ans[idx]))


def DGarland(n, gar):
	gar = list(gar)
	j = 0
	for i in range(n - 1):
		dg = ['B', 'G', 'R']
		if gar[i] == gar[i + 1]:
			if i + 2 < n:
				dg.remove(gar[i + 2])
			if gar[i] in dg:
				dg.remove(gar[i])
			j += 1
			gar[i + 1] = dg[0]
	gar = ''.join(gar)
	return (j, gar)
n = int(input())
gar = input()
(i, res) = DGarland(n, gar)
print(i)
print(res)


n = int(input())
lst = list(input())
d = {0: {'B': 0, 'G': 0, 'R': 0}, 1: {'B': 0, 'G': 0, 'R': 0}, 2: {'B': 0, 'G': 0, 'R': 0}}
for (i, x) in enumerate(lst):
	d[i % 3][x] += 1
mas = ['BGR', 'BRG', 'GBR', 'GRB', 'RGB', 'RBG']
(result, new) = (1000000000000000000000000000, '')
for (i, x) in enumerate(mas):
	res = 0
	for (j, y) in enumerate(x):
		if y == 'B':
			res += d[j]['G'] + d[j]['R']
		elif y == 'G':
			res += d[j]['B'] + d[j]['R']
		else:
			res += d[j]['G'] + d[j]['B']
	if res < result:
		result = res
		new = x
print(result)
s = new * (n // 3 + 1)
print(s[:n])


n = int(input())
s = str(input())
arr = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
case1 = 0
for i in range(n):
	if s[i] == 'B':
		arr[0][i % 3] += 1
	elif s[i] == 'R':
		arr[1][i % 3] += 1
	else:
		arr[2][i % 3] += 1
ans = 0
arrx = []
arrx.append(arr[0][0] + arr[1][1] + arr[2][2])
arrx.append(arr[0][0] + arr[1][2] + arr[2][1])
arrx.append(arr[0][1] + arr[1][0] + arr[2][2])
arrx.append(arr[0][1] + arr[1][2] + arr[2][0])
arrx.append(arr[0][2] + arr[1][1] + arr[2][0])
arrx.append(arr[0][2] + arr[1][0] + arr[2][1])
max1 = max(arrx)
index1 = arrx.index(max1)
print(n - max1)
s1 = ''
if index1 == 0:
	for i in range(n):
		if i % 3 == 0:
			s1 += 'B'
		elif i % 3 == 1:
			s1 += 'R'
		else:
			s1 += 'G'
elif index1 == 1:
	for i in range(n):
		if i % 3 == 0:
			s1 += 'B'
		elif i % 3 == 2:
			s1 += 'R'
		else:
			s1 += 'G'
elif index1 == 2:
	for i in range(n):
		if i % 3 == 1:
			s1 += 'B'
		elif i % 3 == 0:
			s1 += 'R'
		else:
			s1 += 'G'
elif index1 == 3:
	for i in range(n):
		if i % 3 == 1:
			s1 += 'B'
		elif i % 3 == 2:
			s1 += 'R'
		else:
			s1 += 'G'
elif index1 == 4:
	for i in range(n):
		if i % 3 == 2:
			s1 += 'B'
		elif i % 3 == 1:
			s1 += 'R'
		else:
			s1 += 'G'
elif index1 == 5:
	for i in range(n):
		if i % 3 == 2:
			s1 += 'B'
		elif i % 3 == 0:
			s1 += 'R'
		else:
			s1 += 'G'
print(s1)


n = int(input())
l = list(input())
ans = 0
if n == 2:
	use = ['R', 'G', 'B']
	if l[0] == l[1]:
		use.remove(l[0])
		l[1] = use[0]
		ans += 1
	print(ans)
	print(''.join(l))
	exit()
for i in range(1, n - 1):
	use = ['R', 'G', 'B']
	if l[i] == l[i - 1]:
		if l[i - 1] == l[i + 1]:
			use.remove(l[i])
			l[i] = use[0]
		else:
			use.remove(l[i - 1])
			use.remove(l[i + 1])
			l[i] = use[0]
		ans += 1
use = ['R', 'G', 'B']
if n > 1 and l[-1] == l[-2]:
	use.remove(l[-2])
	ans += 1
	l[-1] = use[0]
print(ans)
print(''.join(l))


n = int(input())
s = input()
s = s + '0'
li = list(s)
baal_falan = 0
cn = 0
sv = ['R', 'G', 'B']
for i in range(n):
	if li[i] != li[i + 1]:
		baal_falan = 1
	else:
		cn += 1
		if sv[0] != li[i] and sv[0] != li[i + 2]:
			li[i + 1] = sv[0]
		elif sv[1] != li[i] and sv[1] != li[i + 2]:
			li[i + 1] = sv[1]
		elif sv[2] != li[i] and sv[2] != li[i + 2]:
			li[i + 1] = sv[2]
print(cn)
print(''.join(li[0:n]))


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import combinations
import functools
import sys
import math
MAX = sys.maxsize
MAXN = 10 ** 6 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN():
	return map(int, sys.stdin.readline().strip().split())

def charIN():
	return sys.stdin.readline().strip().split()

def ncr(n, k):
	res = 1
	c = [0] * (k + 1)
	c[0] = 1
	for i in range(1, n + 1):
		for j in range(min(i, k), 0, -1):
			c[j] = (c[j] + c[j - 1]) % MOD
	return c[k]

def chk(x, y):
	s = ['B', 'G', 'R']
	s.remove(x)
	if y in s:
		s.remove(y)
	return s[0]
n = int(input())
s = [i for i in input()] + ['*']
cnt = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		s[i] = chk(s[i - 1], s[i + 1])
		cnt += 1
print(cnt)
print(''.join(s[:n]))


n = int(input())
flower = input()
possible = ['RGB', 'GBR', 'BRG', 'GRB', 'RBG', 'BGR']
ans = n
pattern = 0
for i in possible:
	times = 0
	for (idx, f) in enumerate(flower):
		if f != i[idx % 3]:
			times += 1
	if times < ans:
		ans = times
		pattern = i
print(ans)
print(pattern * (n // 3) + pattern[:n % 3])


n = int(input())
f = ['R', 'G', 'B']
s = list(input())
i = 1
x = 0
while i < len(s) - 1:
	if s[i] == s[i - 1]:
		h = f[:]
		h.remove(s[i - 1])
		if s[i + 1] in h:
			h.remove(s[i + 1])
		s[i] = h[0]
		i += 1
		x += 1
	i += 1
if n > 1 and s[-1] == s[-2]:
	h = f[:]
	h.remove(s[-1])
	s[i] = h[0]
	x += 1
print(x)
d = ''
for i in s:
	d += i
print(d)


a = int(input())
b = input()
new = b[0]
coun = 0
b += 'c'
for i in range(1, a):
	if b[i] == new[i - 1]:
		if b[i - 1] != 'G' and b[i + 1] != 'G':
			new += 'G'
		elif b[i - 1] != 'R' and b[i + 1] != 'R':
			new += 'R'
		elif b[i - 1] != 'B' and b[i + 1] != 'B':
			new += 'B'
		coun += 1
	else:
		new += b[i]
print(coun)
print(new)


n = int(input())
a = list(input())
ans = 0
if n == 1:
	print(0)
	print(a[0])
	exit()
for i in range(1, n - 1):
	if a[i - 1] == a[i] and a[i] == a[i + 1] and (a[i] == 'R'):
		a[i] = 'G'
		ans += 1
	elif a[i - 1] == a[i] and a[i] == a[i + 1] and (a[i] == 'B'):
		a[i] = 'G'
		ans += 1
	elif a[i - 1] == a[i] and a[i] == a[i + 1] and (a[i] == 'G'):
		a[i] = 'B'
		ans += 1
for i in range(1, n - 1):
	if a[i] == a[i - 1]:
		if a[i + 1] == 'R':
			if a[i] == 'G':
				a[i] = 'B'
				ans += 1
			else:
				a[i] = 'G'
				ans += 1
		elif a[i + 1] == 'G':
			if a[i] == 'R':
				a[i] = 'B'
				ans += 1
			else:
				a[i] = 'R'
				ans += 1
		elif a[i] == 'G':
			a[i] = 'R'
			ans += 1
		else:
			a[i] = 'G'
			ans += 1
if a[n - 1] == a[n - 2] and a[n - 1] == 'R':
	a[n - 1] = 'B'
	ans += 1
if a[n - 1] == a[n - 2] and a[n - 1] == 'B':
	a[n - 1] = 'R'
	ans += 1
if a[n - 1] == a[n - 2] and a[n - 1] == 'G':
	a[n - 1] = 'B'
	ans += 1
print(ans)
for i in range(n):
	print(a[i], end='')
print()


from itertools import *
n = int(input())
s = input()
(r, t) = min(((sum((x != y for (x, y) in zip(s, cycle(t)))), t) for t in permutations('RGB')))
print(r, ''.join(t * n)[:n])


import sys
import math

def getAndParseInt(num=1):
	string = sys.stdin.readline().strip()
	if num == 1:
		return int(string)
	else:
		return [int(part) for part in string.split()]

def getAndParseString(num=1, delim=' '):
	string = sys.stdin.readline().strip()
	if num == 1:
		return string
	else:
		return [part for part in string.split(delim)]
n = getAndParseInt()
lamps = getAndParseString()
perms = ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']
best = 0
best_changes = n + 1
blocks = math.ceil(n / 3)
for (index, perm) in enumerate(perms):
	changes = 0
	for b in range(blocks):
		start = 0
		while start < 3 and b * 3 + start < n:
			if lamps[b * 3 + start] != perm[start]:
				changes += 1
			start += 1
	if changes < best_changes:
		best = index
		best_changes = changes
print(best_changes)
out_string = perms[best] * (n // 3) + perms[best][:n % 3]
print(out_string)


n = int(input())
s = input()
m = []
sep1 = False
sep2 = False
for i in s:
	if not m:
		m.append([i])
	else:
		if m[-1][-1] == i and sep1:
			t = m[-1].pop()
			m.append([t, i])
			sep1 = False
			sep2 = True
		elif m[-1][-1] == i:
			m[-1] += [i]
			sep2 = True
		if m[-1][-1] != i and sep2:
			m.append([i])
			sep2 = False
			sep1 = True
		elif m[-1][-1] != i:
			m[-1] += [i]
			sep1 = True
m = list(filter(lambda x: x, m))
sol = []
c = 0
al = set(['B', 'R', 'G'])
for (i, e) in enumerate(m):
	if len(e) == 1:
		sol += e
	elif e[0] == e[1]:
		c += len(e) // 2
		if i == len(m) - 1:
			ch = list(al - set([e[0]]))
			if len(e) % 2 == 0:
				sol += [e[0], ch[0]] * (len(e) // 2)
			else:
				sol += [e[0]] + [ch[0], e[0]] * (len(e) // 2)
		else:
			ch = list(al - set([e[0], m[i + 1][0]]))
			if len(e) % 2 == 0:
				sol += [e[0], ch[0]] * (len(e) // 2)
			else:
				sol += [e[0]] + [ch[0], e[0]] * (len(e) // 2)
	else:
		sol += e
print(c)
print(*sol, sep='')


n = int(input())
s = input()
p = 'RGB' * 100000
q = 'RBG' * 100000
r = p[1:]
a = p[2:]
b = q[1:]
c = q[2:]
p1 = q1 = r1 = a1 = b1 = c1 = 0
for i in range(n):
	if p[i] != s[i]:
		p1 += 1
	if q[i] != s[i]:
		q1 += 1
	if r[i] != s[i]:
		r1 += 1
	if a[i] != s[i]:
		a1 += 1
	if b[i] != s[i]:
		b1 += 1
	if c[i] != s[i]:
		c1 += 1
m = min(p1, q1, r1, a1, b1, c1)
print(m)
if m == p1:
	print(p[:n])
elif m == q1:
	print(q[:n])
elif m == r1:
	print(r[:n])
elif m == a1:
	print(a[:n])
elif m == b1:
	print(b[:n])
else:
	print(c[:n])


k = int(input())
s = input().strip()
if k < 3:
	if k == 1:
		print(0)
		print(s)
	if k == 2:
		if len(set(s)) == 2:
			print(0)
			print(s)
		else:
			print(1)
			res = ''.join(list(set(s)))
			for i in 'RGB':
				if i not in res:
					res += i
					break
			print(res)
else:
	a = 'RGB'
	b = 'GRB'
	c = 'BGR'
	d = 'GBR'
	e = 'RBG'
	f = 'BRG'
	m = [a, b, c, d, e, f]
	ans = 100000000000000
	res = ''
	for xx in m:
		ctr = 0
		x = xx * (k // 3 + k % 3)
		for (ind, i) in enumerate(x[:k]):
			if x[ind] != s[ind]:
				ctr += 1
		if ans > ctr:
			ans = ctr
			res = x[:k]
	print(ans)
	print(res)


from itertools import *
a = n = int(input())
s = input()
for p in permutations('RGB'):
	t = ''.join(islice(cycle(p), n))
	v = sum(map(lambda x, y: x != y, s, t))
	if v < a:
		a = v
		u = t
print(a)
print(u)


n = int(input())
a = list(input())
b = a.copy()
if n == 1:
	print(0)
	print(a[0])
else:
	for i in range(1, n - 1):
		if a[i] != a[i - 1] and a[i] != a[i + 1]:
			continue
		elif a[i] == a[i - 1] == a[i + 1]:
			if a[i] == 'R':
				a[i] = 'G'
			else:
				a[i] = 'R'
	for i in range(1, n - 1):
		if a[i] == a[i - 1] or a[i] == a[i + 1]:
			if a[i - 1] == 'R':
				if a[i + 1] == 'B':
					a[i] = 'G'
				else:
					a[i] = 'B'
			elif a[i - 1] == 'B':
				if a[i + 1] == 'G':
					a[i] = 'R'
				else:
					a[i] = 'G'
			elif a[i + 1] == 'R':
				a[i] = 'B'
			else:
				a[i] = 'R'
	if a[-1] == a[-2]:
		if a[-1] == 'R':
			a[-1] = 'G'
		else:
			a[-1] = 'R'
	answer = 0
	for j in range(n):
		if a[j] != b[j]:
			answer += 1
	print(answer)
	print(''.join(a))


def dif(n, m):
	cnt = 0
	for (i, j) in zip(n, m):
		if j != i:
			cnt += 1
	return cnt
n = int(input())
inp = list(input())
if n == 1:
	print(0)
	print(''.join(inp))
else:
	s = inp[:]
	cnt = 0
	for i in range(1, n - 1):
		if inp[i] == inp[i - 1]:
			cnt += 1
			ini = ['R', 'G', 'B']
			ini.remove(inp[i - 1])
			if inp[i + 1] in ini:
				ini.remove(inp[i + 1])
			inp[i] = ini[0]
			i += 1
	inp.pop(-1)
	if inp[-1] == s[-1]:
		cnt += 1
		if s[-1] == 'R':
			inp.append('B')
		else:
			inp.append('R')
	else:
		inp.append(s[-1])
	print(dif(inp, s))
	print(''.join(inp))


import math
n = int(input())
r0 = 0
b0 = 0
g0 = 0
r1 = 0
b1 = 0
g1 = 0
r2 = 0
b2 = 0
g2 = 0
s = input()
a = []
b = []
c = []
for i in range(n):
	if i % 3 == 0:
		if s[i] == 'R':
			r0 += 1
		if s[i] == 'G':
			g0 += 1
		if s[i] == 'B':
			b0 += 1
	elif i % 3 == 1:
		if s[i] == 'R':
			r1 += 1
		if s[i] == 'G':
			g1 += 1
		if s[i] == 'B':
			b1 += 1
	else:
		if s[i] == 'R':
			r2 += 1
		if s[i] == 'G':
			g2 += 1
		if s[i] == 'B':
			b2 += 1
a.append(r0)
a.append(g0)
a.append(b0)
b.append(r1)
b.append(g1)
b.append(b1)
c.append(r2)
c.append(g2)
c.append(b2)
Max = 0
maxi = 0
maxj = 0
maxk = 0
for i in range(3):
	for j in range(3):
		for k in range(3):
			if Max < a[i] + b[j] + c[k] and i != j and (j != k) and (i != k):
				Max = a[i] + b[j] + c[k]
				maxi = i
				maxj = j
				maxk = k
print(sum(a) + sum(b) + sum(c) - Max)
if maxi == 0:
	Res = 'R'
elif maxi == 1:
	Res = 'G'
elif maxi == 2:
	Res = 'B'
if maxj == 0:
	Res = Res + 'R'
elif maxj == 1:
	Res = Res + 'G'
elif maxj == 2:
	Res += 'B'
if maxk == 0:
	Res += 'R'
elif maxk == 1:
	Res += 'G'
elif maxk == 2:
	Res += 'B'
print(Res * math.floor(n / 3) + Res[0:n % 3])


from itertools import cycle
import sys

def repeat_to_length(string_to_expand, length):
	return (string_to_expand * (int(length / len(string_to_expand)) + 1))[:length]
input()
seq1 = input()
p = ''
pc = sys.maxsize
seq2 = cycle('RGB')
t = sum((1 for (a, b) in zip(seq1, seq2) if a != b))
if t < pc:
	p = 'RGB'
	pc = t
seq2 = cycle('GRB')
t = sum((1 for (a, b) in zip(seq1, seq2) if a != b))
if t < pc:
	p = 'GRB'
	pc = t
seq2 = cycle('BRG')
t = sum((1 for (a, b) in zip(seq1, seq2) if a != b))
if t < pc:
	p = 'BRG'
	pc = t
seq2 = cycle('RBG')
t = sum((1 for (a, b) in zip(seq1, seq2) if a != b))
if t < pc:
	p = 'RBG'
	pc = t
seq2 = cycle('GBR')
t = sum((1 for (a, b) in zip(seq1, seq2) if a != b))
if t < pc:
	p = 'GBR'
	pc = t
seq2 = cycle('BGR')
t = sum((1 for (a, b) in zip(seq1, seq2) if a != b))
if t < pc:
	p = 'BGR'
	pc = t
print(pc)
print(repeat_to_length(p, len(seq1)))


h = 1
input()
p = 'x'
r = 1
t = []
for c in input().lower():
	if h != 1:
		p = next(iter(set('bgr') - {p, c}))
		t.append(p)
		h = 1
	if c != p:
		t.append(c)
	else:
		h = 2
		r += 1
	p = c
if h != 1:
	p = next(iter(set('bg') - {p}))
	t.append(p)
print(r - 1)
print(''.join(t).upper())


n = int(input())
string = list(input())

def required(tp):
	change = 0
	(s, i) = (tp[0], 0)
	while i < n:
		if string[i] != s:
			change += 1
		i += 3
	(s, i) = (tp[1], 1)
	while i < n:
		if string[i] != s:
			change += 1
		i += 3
	(s, i) = (tp[2], 2)
	while i < n:
		if string[i] != s:
			change += 1
		i += 3
	return change
best = float('inf')
pattern = None
for pat in ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']:
	req = required(pat)
	if req < best:
		best = req
		pattern = pat
ans = ''
ans += pattern * (n // 3) + pattern[:n % 3]
print(best)
print(ans)


n = int(input())
s = input()
l = len(s)
color = ['R', 'B', 'G']
count = 0
col = list(s)
if l == 1:
	print(0)
	print(s)
	exit(0)
if l == 2:
	if col[0] != col[1]:
		print(1)
		color.remove(col[1])
		count += 1
		col[0] = color[0]
		print(''.join(col))
		exit(0)
for i in reversed(range(1, l - 1)):
	if col[i] == col[i + 1]:
		for j in color:
			if j != col[i - 1] and j != col[i + 1]:
				count += 1
				col[i] = j
				break
if col[1] == col[0]:
	color.remove(col[1])
	count += 1
	col[0] = color[0]
print(count)
print(''.join(col))


n = int(input())
s = list(input()) + ['#']
ans = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		ans += 1
		for j in 'RGB':
			if s[i] != j and s[i + 1] != j:
				s[i] = j
				break
print(ans)
print(*s[:-1], sep='')


n = int(input())
p = input().rstrip()
p = list(p)
SS = 0
for i in range(0, len(p) - 1):
	if p[i] == p[i + 1]:
		SS = SS + 1
		if i == len(p) - 2:
			if p[i + 1] == 'B':
				p[i + 1] = 'G'
			elif p[i + 1] == 'G':
				p[i + 1] = 'B'
			elif p[i + 1] == 'R':
				p[i + 1] = 'G'
		else:
			D = []
			D.append(p[i + 2])
			D.append(p[i])
			if 'G' not in D:
				p[i + 1] = 'G'
			elif 'B' not in D:
				p[i + 1] = 'B'
			elif 'R' not in D:
				p[i + 1] = 'R'
print(SS)
print(''.join(p))


from collections import Counter
from itertools import permutations

def main():
	(n, s) = (int(input()), input())
	cnts = [Counter(s[i::3]) for i in range(3)]
	(x, rgb) = max(((sum((cnt[c] for (c, cnt) in zip(rgb, cnts))), rgb) for rgb in permutations('RGB')))
	print(n - x)
	print((''.join(rgb) * ((n + 2) // 3))[:n])
main()


n = int(input())
s = list(input())
ans = 0
alth = 'RGB'
for i in range(1, n):
	if s[i] == s[i - 1]:
		if i < n - 1:
			s[i] = alth[(alth.find(s[i]) + 1) % 3]
			s[i] = alth[(alth.find(s[i]) + int(s[i] == s[i + 1])) % 3]
		else:
			s[i] = alth[(alth.find(s[i]) + 1) % 3]
		ans += 1
print(ans)
print(''.join(s))


n = int(input())
s = list(input())
a = False
ans = 0
if n > 1:
	for i in range(n - 2):
		if a:
			a = False
			continue
		if s[i] == s[i + 1]:
			a = True
			ans += 1
			if s[i] != s[i + 2]:
				s[i + 1] = chr(219 - ord(s[i]) - ord(s[i + 2]))
			elif s[i] == 'B':
				s[i + 1] = 'G'
			else:
				s[i + 1] = 'B'
	if s[-2] == s[-1]:
		if s[-2] == 'B':
			s[-1] = 'R'
		else:
			s[-1] = 'B'
		ans += 1
	print(ans)
	print(''.join(s))
else:
	print(0)
	print(''.join(s))


n = int(input())
s = input() + 'X'
change = 0
s = list(s)
for i in range(0, n - 1):
	if s[i] == s[i + 1]:
		for c in 'RGB':
			if c != s[i] and c != s[i + 2]:
				s[i + 1] = c
				break
		change += 1
print(change)
print(''.join((s[i] for i in range(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(ans)
print(strans)


from sys import stdin, stdout
from collections import defaultdict
import math
I = stdin.readline
P = stdout.write
n = int(I())
s = I().rstrip()
r = n % 3
t = n // 3
strings = []
s1 = ['RGB' * t]
if r == 1 or r == 2:
	s1.append('R')
if r == 2:
	s1.append('G')
s1 = ''.join(s1)
strings.append(s1)
s2 = ['RBG' * t]
if r == 1 or r == 2:
	s2.append('R')
if r == 2:
	s2.append('B')
s2 = ''.join(s2)
strings.append(s2)
s1 = ['BGR' * t]
if r == 1 or r == 2:
	s1.append('B')
if r == 2:
	s1.append('G')
s1 = ''.join(s1)
strings.append(s1)
s1 = ['BRG' * t]
if r == 1 or r == 2:
	s1.append('B')
if r == 2:
	s1.append('R')
s1 = ''.join(s1)
strings.append(s1)
s1 = ['GBR' * t]
if r == 1 or r == 2:
	s1.append('G')
if r == 2:
	s1.append('B')
s1 = ''.join(s1)
strings.append(s1)
s1 = ['GRB' * t]
if r == 1 or r == 2:
	s1.append('G')
if r == 2:
	s1.append('R')
s1 = ''.join(s1)
strings.append(s1)
ans = math.inf
st = str()
for i in strings:
	count = 0
	for j in range(len(s)):
		if s[j] != i[j]:
			count += 1
	if count < ans:
		ans = count
		st = i
print(ans)
print(st)


def solve(s, pattern):
	cost = 0
	for i in range(len(s)):
		if s[i] != pattern[i % 3]:
			cost += 1
	return cost
n = int(input())
s = input().strip()
arr = ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']
minn = 10 ** 100
index = 0
for i in range(len(arr)):
	c = solve(s, arr[i])
	if c < minn:
		minn = c
		index = i
print(minn)
for i in range(n):
	print(arr[index][i % 3], end='')
print('')


n = int(input())
s = input()
cases = ['RGB' * (n // 3) + 'RGB'[:n % 3], 'RBG' * (n // 3) + 'RBG'[:n % 3], 'GRB' * (n // 3) + 'GRB'[:n % 3], 'GBR' * (n // 3) + 'GBR'[:n % 3], 'BRG' * (n // 3) + 'BRG'[:n % 3], 'BGR' * (n // 3) + 'BGR'[:n % 3]]
mn = 200000
mni = -1
for (i, c) in enumerate(cases):
	d = len([1 for (_, __) in zip(s, c) if _ != __])
	if d < mn:
		mn = d
		mni = i
print(mn)
print(cases[mni])


size = int(input())
string = input()
i = size % 3
temp = 'RGB'
string1 = 'RGB' * int(size / 3)
for l in range(i):
	string1 += temp[l]
temp = 'RBG'
string2 = 'RBG' * int(size / 3)
for l in range(i):
	string2 += temp[l]
temp = 'GRB'
string3 = 'GRB' * int(size / 3)
for l in range(i):
	string3 += temp[l]
temp = 'GBR'
string4 = 'GBR' * int(size / 3)
for l in range(i):
	string4 += temp[l]
temp = 'BGR'
string5 = 'BGR' * int(size / 3)
for l in range(i):
	string5 += temp[l]
temp = 'BRG'
string6 = 'BRG' * int(size / 3)
for l in range(i):
	string6 += temp[l]
mini = 0
ans = ''
l = [string1, string2, string3, string4, string5, string6]
for st in l:
	temp = 0
	for o in range(size):
		if st[o] != string[o]:
			temp += 1
	if mini == 0 or temp < mini:
		mini = temp
		ans = st
print(mini)
print(ans)


len = int(input())
a = str(input())
str = ['GRB', 'GBR', 'RGB', 'RBG', 'BGR', 'BRG']
ans = 1
max = 100000000000000
for i in range(0, 6):
	now = 0
	for j in range(0, len):
		if a[j] != str[i][j % 3]:
			now += 1
	if now < max:
		max = now
		ans = i
print(max)
for i in range(0, len):
	print(str[ans][i % 3], end='')


(n, a) = (int(input()), input())
col = 'RGB'
ans = 0
i = 0
b = list(a)
while i < n:
	j = i + 1
	while j < n and a[j] == a[i]:
		j += 1
	ans += (j - i) // 2
	for k in range(i + 1, j, 2):
		for x in range(len(col)):
			if col[x] != a[k - 1] and (k == n - 1 or col[x] != a[k + 1]):
				b[k] = col[x]
				break
	i = j
print(ans)
print(''.join(b[:n]))


n = int(input())
a = list(input())
s = {'R', 'G', 'B'}
i = 0
cnt = 0
while i < n - 1:
	if a[i] == a[i + 1]:
		s1 = set()
		s1.add(a[i])
		if i + 2 < n:
			s1.add(a[i + 2])
		s1 = s - s1
		a[i + 1] = s1.pop()
		i = i + 1
		cnt = cnt + 1
		if i == n - 2:
			break
	i = i + 1
print(cnt)
print(''.join((str(i) for i in a)))


n = int(input())
str1 = input()
l = len(str1)
t = l % 3
t = int(t)
s1 = 'RGB'
s2 = 'RBG'
s3 = 'GRB'
s4 = 'GBR'
s5 = 'BRG'
s6 = 'BGR'
x = l // 3
s1 = s1 * x
s2 = s2 * x
s3 = s3 * x
s4 = s4 * x
s5 = s5 * x
s6 = s6 * x
if t == 1:
	s1 += 'R'
	s2 += 'R'
	s3 += 'G'
	s4 += 'G'
	s5 += 'B'
	s6 += 'B'
elif t == 2:
	s1 += 'RG'
	s2 += 'RB'
	s3 += 'GR'
	s4 += 'GB'
	s5 += 'BR'
	s6 += 'BG'
L = []
L.append(s1)
L.append(s2)
L.append(s3)
L.append(s4)
L.append(s5)
L.append(s6)
M = [0, 0, 0, 0, 0, 0]
for i in range(len(L)):
	for j in range(len(str1)):
		if str1[j] != L[i][j]:
			M[i] += 1
minn = 0
for i in range(6):
	if M[i] < M[minn]:
		minn = i
print(M[minn])
print(L[minn])


n = int(input())
rbg = list(input())
colors = ['R', 'B', 'G']
mincount = 10 ** 8
minrbg = []
for c in colors:
	newcolors = []
	for a in colors:
		if not a == c:
			newcolors.append(a)
	for b in newcolors:
		for lastcolor in newcolors:
			if not lastcolor == b:
				d = lastcolor
		count = 0
		newrbg = []
		for i in range(n):
			if i % 3 == 0:
				newrbg.append(c)
				if not rbg[i] == c:
					count += 1
			if i % 3 == 1:
				newrbg.append(b)
				if not rbg[i] == b:
					count += 1
			if i % 3 == 2:
				newrbg.append(d)
				if not rbg[i] == d:
					count += 1
		if count <= mincount:
			mincount = count
			minrbg = newrbg
print(mincount)
print(''.join(minrbg))


from itertools import permutations
from sys import stdin
n = int(input())
string = stdin.readline().strip()
l = 'RGB'
if n == 1:
	print(0)
	print(string)
elif n == 2:
	if string[0] != string[1]:
		print(0)
		print(string)
	else:
		print(1)
		print(string[0] + l[l.index(string[0]) - 1])
else:
	ans = 300000
	res = ''
	for a in permutations(l):
		(d, m) = divmod(n, 3)
		b = d * ''.join(a)
		if m == 1:
			b += a[0]
		if m == 2:
			b = b + a[0] + a[1]
		distance = 0
		for i in range(n):
			if string[i] != b[i]:
				distance += 1
		if distance < ans:
			ans = distance
			res = b
	print(ans)
	print(res)


t = int(input())
inp = input()
minv = 1000000
index = 0
d = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
e = ['RG', 'RB', 'GR', 'GB', 'BR', 'BG']
for j in range(0, 6):
	minele = d[j]
	count = 0
	for i in range(0, t):
		val = minele[i % 3]
		if val != inp[i]:
			count += 1
	if count < minv:
		minv = count
		index = j
if t == 1:
	print(0)
	print(inp[0])
elif t == 2:
	print(minv)
	print(e[index])
else:
	print(minv)
	ele = d[index]
	st = ''
	for i in range(0, t):
		st += ele[i % 3]
	print(st)


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac
from itertools import permutations as permu

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
n = int(z())
l = stdin.readline()
ans1 = ['R', 'G', 'B']
ans3 = ['B', 'G', 'R']
ans2 = ['G', 'B', 'R']
t2 = 0
s2 = ''
t3 = 0
s3 = ''
t1 = 0
s1 = ''
ans6 = ['R', 'B', 'G']
t6 = 0
s6 = ''
ans2 = ['G', 'B', 'R']
t2 = 0
s2 = ''
ans2 = ['G', 'B', 'R']
t2 = 0
s2 = ''
ans5 = ['B', 'R', 'G']
t5 = 0
s5 = ''
ans4 = ['G', 'R', 'B']
t4 = 0
s4 = ''
for i in range(n):
	tt = l[i]
	if tt != ans1[i % 3]:
		t1 += 1
	if tt != ans2[i % 3]:
		t2 += 1
	if tt != ans3[i % 3]:
		t3 += 1
	if tt != ans4[i % 3]:
		t4 += 1
	if tt != ans5[i % 3]:
		t5 += 1
	if tt != ans6[i % 3]:
		t6 += 1
res = min(t1, t2, t3, t4, t5, t6)
print(res)
if res == t1:
	print(''.join(ans1) * (n // 3) + ''.join(ans1)[:n % 3])
elif res == t2:
	print(''.join(ans2) * (n // 3) + ''.join(ans2)[:n % 3])
elif res == t3:
	print(''.join(ans3) * (n // 3) + ''.join(ans3)[:n % 3])
elif res == t4:
	print(''.join(ans4) * (n // 3) + ''.join(ans4)[:n % 3])
elif res == t5:
	print(''.join(ans5) * (n // 3) + ''.join(ans5)[:n % 3])
else:
	print(''.join(ans6) * (n // 3) + ''.join(ans6)[:n % 3])


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def unlike(a, b):
	if a == b:
		if a == 'B':
			return 'R'
		elif a == 'G':
			return 'R'
		else:
			return 'B'
	elif a == 'R':
		if b == 'B':
			return 'G'
		else:
			return 'B'
	elif a == 'G':
		if b == 'B':
			return 'R'
		else:
			return 'B'
	elif b == 'R':
		return 'G'
	else:
		return 'R'
n = int(input())
s = input()
c = 0
a = list(s)
if n == 1:
	print(0)
	print(s)
else:
	for i in range(1, n - 1):
		if a[i] == a[i - 1]:
			a[i] = unlike(s[i - 1], s[i + 1])
			c += 1
	if a[-1] == a[-2]:
		a[-1] = unlike(a[-2], a[0])
		c += 1
	print(c)
	print(''.join(a))


def check(st1, st):
	res = 0
	for i in range(len(st)):
		if st[i] != st1[i % 3]:
			res += 1
	return res
n = int(input())
s = str(input())
colors = ['RGB', 'RBG', 'BGR', 'BRG', 'GRB', 'GBR']
mn = int(n + 1)
for x in range(6):
	mn = min(mn, check(colors[x], s))
print(mn)
for it in colors:
	if check(it, s) == mn:
		st = 0
		while st < n:
			print(it[st % 3], end='')
			st += 1
		break


import math
n = int(input())
garland = input().strip()
possibles = ['RGB', 'GBR', 'BGR', 'BRG', 'RBG', 'GRB']
mini = -1
answer = '-1'
for possible in possibles:
	newGarland = possible * math.floor(n / 3)
	for i in range(n % 3):
		newGarland += possible[i]
	currentMin = 0
	for i in range(len(newGarland)):
		if newGarland[i] != garland[i]:
			currentMin += 1
	if mini == -1 or currentMin < mini:
		mini = currentMin
		answer = newGarland
print(mini)
print(answer)


TN = 1

def solution():
	n = int(input())
	l = list(input())
	s = ['RGB' * (n // 3) + 'RGB'[:n % 3], 'RBG' * (n // 3) + 'RBG'[:n % 3], 'GBR' * (n // 3) + 'GBR'[:n % 3], 'GRB' * (n // 3) + 'GRB'[:n % 3], 'BGR' * (n // 3) + 'BGR'[:n % 3], 'BRG' * (n // 3) + 'BRG'[:n % 3]]
	ans = [0 for i in range(6)]
	for i in range(6):
		for j in range(n):
			if s[i][j] != l[j]:
				ans[i] += 1
	print(min(ans))
	print(s[ans.index(min(ans))])
while TN != 0:
	solution()
	TN -= 1


n = int(input())
s = input()
counter = 0

def color(output, i, s):
	if output[len(output) - 1] == 'R' and s[i] == 'R':
		if s[i + 1] == 'G':
			return 'B'
		return 'G'
	elif output[len(output) - 1] == 'G' and s[i] == 'G':
		if s[i + 1] == 'R':
			return 'B'
		return 'R'
	elif output[len(output) - 1] == 'B' and s[i] == 'B':
		if s[i + 1] == 'R':
			return 'G'
		return 'R'
	else:
		return s[i]
output = s[0]
for i in range(1, n - 1):
	val = color(output, i, s)
	if val != s[i]:
		counter = counter + 1
	output = output + val
if len(s) > 1:
	if output[n - 2] == s[n - 1]:
		counter = counter + 1
		if output[n - 2] == 'R' and s[n - 1] == 'R':
			output = output + 'G'
		elif output[n - 2] == 'G' and s[n - 1] == 'G':
			output = output + 'R'
		else:
			output = output + 'R'
	else:
		output = output + s[n - 1]
print(counter)
print(output)


def ans(n, g, v):
	blocks = []
	(i, j) = (0, 1)
	gar = ''
	counter = 0
	while j < n:
		if g[i] == g[j]:
			j += 1
		else:
			blocks.append(g[i:j])
			i = j
			j += 1
	blocks.append(g[i:])
	for i in range(len(blocks)):
		if len(blocks[i]) == 1:
			gar += blocks[i]
		else:
			counter += len(blocks[i]) // 2
			b = blocks[i]
			tmp = ''
			if i == len(blocks) - 1:
				for j in range(len(b)):
					if j % 2 == 0:
						tmp += b[j]
					else:
						for z in v:
							if z != b[j]:
								tmp += z
								break
			else:
				for j in range(len(b)):
					if j % 2 == 0:
						tmp += b[j]
					else:
						for z in v:
							if z != b[j] and z != blocks[i + 1][0]:
								tmp += z
								break
			gar += tmp
	return (counter, gar)
n = int(input())
gar = input()
values = ['G', 'R', 'B']
tmp = ans(n, gar, values)
print(tmp[0])
print(tmp[1])


l = ['RG', 'GB', 'BR', 'BG', 'RB', 'GR']
a = ['R', 'G', 'B']
n = int(input())
k1 = input()
k = [i for i in k1]
sp = 0
for i in range(1, n):
	if k[i] == k[i - 1]:
		sp += 1
		if i + 1 < n:
			if k[i - 1] != 'R' and k[i + 1] != 'R':
				k[i] = 'R'
			elif k[i - 1] != 'G' and k[i + 1] != 'G':
				k[i] = 'G'
			elif k[i - 1] != 'B' and k[i + 1] != 'B':
				k[i] = 'B'
		elif k[i - 1] != 'R':
			k[i] = 'R'
		else:
			k[i] = 'G'
print(sp)
print(''.join(k))


import sys
from math import *
n = int(input())
dat = list(input())
out = 0
if len(dat) > 2:
	for i in range(1, len(dat) - 1):
		m = list('RGB')
		if dat[i - 1] == dat[i] == dat[i + 1]:
			m.remove(dat[i])
			dat[i] = m[0]
			out += 1
dat = list(dat)
for i in range(1, len(dat) - 1):
	m = list('RGB')
	if dat[i - 1] == dat[i]:
		m.remove(dat[i - 1])
		m.remove(dat[i + 1])
		dat[i] = m[0]
		out += 1
if len(dat) > 1:
	if dat[-1] == dat[-2]:
		m = list('RGB')
		m.remove(dat[-2])
		dat[-1] = m[0]
		out += 1
print(out)
print(''.join(dat))


size = int(input())
word = input()
(R, B, G) = ('R', 'B', 'G')

def build(l1, l2, l3):
	return (l1 + l2 + l3) * (size // 3) + (l1 if size % 3 == 1 else '') + (l1 + l2 if size % 3 == 2 else '')
w0 = word[::3]
w1 = word[1::3]
w2 = word[2::3]
(r0, b0, g0) = (w0.count('R'), w0.count('B'), w0.count('G'))
(r1, b1, g1) = (w1.count('R'), w1.count('B'), w1.count('G'))
(r2, b2, g2) = (w2.count('R'), w2.count('B'), w2.count('G'))
(s1, s2, s3, s4, s5, s6) = (r0 + b1 + g2, r0 + b2 + g1, r1 + b0 + g2, r1 + b2 + g0, r2 + b1 + g0, r2 + b0 + g1)
(s1, s2, s3, s4, s5, s6) = (size - s1, size - s2, size - s3, size - s4, size - s5, size - s6)
print(min(s1, s2, s3, s4, s5, s6))
if s1 == min(s1, s2, s3, s4, s5, s6):
	print(build(R, B, G))
elif s2 == min(s1, s2, s3, s4, s5, s6):
	print(build(R, G, B))
elif s3 == min(s1, s2, s3, s4, s5, s6):
	print(build(B, R, G))
elif s4 == min(s1, s2, s3, s4, s5, s6):
	print(build(G, R, B))
elif s5 == min(s1, s2, s3, s4, s5, s6):
	print(build(G, B, R))
elif s6 == min(s1, s2, s3, s4, s5, s6):
	print(build(B, G, R))


n = int(input())
s = input()
s = list(s)
liste = ['R', 'B', 'G']
i = 1
count = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		s[i] = (set(liste) - set(s[i:i + 2])).pop()
		count += 1
print(count)
print(''.join(s))


n = int(input())
s = list(input())
i = 0
rep = {('B', 'R'): 'G', ('R', 'B'): 'G', ('G', 'R'): 'B', ('R', 'G'): 'B', ('B', 'G'): 'R', ('G', 'B'): 'R', ('R', 'R'): 'B', ('B', 'B'): 'R', ('G', 'G'): 'R'}
count = 0
while i < n - 2:
	if s[i] == s[i + 1]:
		count += 1
		s[i + 1] = rep[s[i], s[i + 2]]
	i += 1
if n > 1 and s[-1] == s[-2]:
	if s[-2] == 'R':
		s[-1] = 'G'
	elif s[-2] == 'G':
		s[-1] = 'B'
	else:
		s[-1] = 'R'
	count += 1
print(count)
print(''.join(s))


import sys
from collections import deque
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def read():
	zz = 0
	if zz:
		input = sys.stdin.readline
	else:
		sys.stdin = open('input1.txt', 'r')
		sys.stdout = open('output1.txt', 'w')
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def solve():
	n = ii()
	s = si()
	if n == 1:
		print(0)
		print(s)
	elif n == 2:
		if s[0] == s[1]:
			print(1)
			if s[0] == 'R':
				print('GR')
			else:
				print('R', end='')
				print(s[1])
		else:
			print('0')
			print(s)
	else:
		s1 = ['RGB', 'BGR', 'RBG', 'BRG', 'GRB', 'GBR']
		ans = n
		mini = 0
		for i in range(6):
			c = 0
			for j in range(n):
				if s[j] != s1[i][j % 3]:
					c += 1
			if c < ans:
				mini = i
				ans = c
		print(ans)
		for i in range(n):
			print(s1[mini][i % 3], end='')
solve()


def cvet(ido, iposle):
	a = ['R', 'G', 'B']
	for i in range(len(a)):
		if a[i] != ido and a[i] != iposle:
			return a[i]
n = int(input())
s = input()
k = 0
vix = s[0]
for i in range(1, len(s)):
	if s[i] == vix[i - 1]:
		if i != len(s) - 1:
			vix += cvet(s[i - 1], s[i + 1])
		else:
			vix += cvet(s[i - 1], s[i - 1])
		k += 1
	else:
		vix += s[i]
print(k)
print(vix)


n = int(input())
t = str(input())
s1 = 'GRB' * int(n / 3) + 'GRB'[:n % 3]
s2 = 'RGB' * int(n / 3) + 'RGB'[:n % 3]
s3 = 'BGR' * int(n / 3) + 'BGR'[:n % 3]
s4 = 'BRG' * int(n / 3) + 'BRG'[:n % 3]
s5 = 'GBR' * int(n / 3) + 'GBR'[:n % 3]
s6 = 'RBG' * int(n / 3) + 'RBG'[:n % 3]
(c1, c2, c3, c4, c5, c6) = (0, 0, 0, 0, 0, 0)
for i in range(n):
	if t[i] != s1[i]:
		c1 += 1
	if t[i] != s2[i]:
		c2 += 1
	if t[i] != s3[i]:
		c3 += 1
	if t[i] != s4[i]:
		c4 += 1
	if t[i] != s5[i]:
		c5 += 1
	if t[i] != s6[i]:
		c6 += 1
ans = min(c1, c2, c3, c4, c5, c6)
if ans == c1:
	print(c1)
	print(s1)
elif ans == c2:
	print(c2)
	print(s2)
elif ans == c3:
	print(c3)
	print(s3)
elif ans == c4:
	print(c4)
	print(s4)
elif ans == c5:
	print(c5)
	print(s5)
elif ans == c6:
	print(c6)
	print(s6)


n = int(input())
r = ''
y = []
d = 0
s = list(input())
a = ['R', 'G', 'B']
for i in range(n - 1):
	if s[i] == s[i + 1]:
		d = d + 1
		if i + 2 < n:
			if s[i + 1] == s[i + 2]:
				s[i + 1] = a[a.index(s[i + 1]) - 1]
			else:
				x = a.index(s[i + 1])
				y = a.index(s[i + 2])
				if x == 1 and y == 2 or (y == 1 and x == 2):
					s[i + 1] = a[0]
				elif x == 1 and y == 0 or (y == 1 and x == 0):
					s[i + 1] = a[2]
				elif x == 0 and y == 2 or (y == 0 and x == 2):
					s[i + 1] = a[1]
if n != 1:
	if s[-1] == s[-2]:
		s[-1] = a[a.index(s[-1]) - 1]
print(d)
print(r.join(s))


import sys

def util(s, b):
	(i, j, count) = (0, 0, 0)
	while i < len(s) and j < len(b):
		if s[i] != b[j]:
			count += 1
		i += 1
		j += 1
		if j == 3:
			j = 0
	return count
ans = ''
n = int(input())
s = input()
a = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
min = sys.maxsize
for i in range(6):
	x = util(s, a[i])
	if x < min:
		min = x
		ans = a[i]
sb = ans * (n // 3)
sb = sb + ans[0:n % 3]
print(min)
print(sb)


n = int(input())
a = list(input())
flag = ['R', 'G', 'B']
count = 0
for i in range(n - 1):
	l = ''
	r = ''
	if a[i] == a[i + 1]:
		if i + 2 < n:
			r = a[i + 2]
			l = a[i]
		else:
			l = a[i]
		if l == r or r == '':
			flag.remove(l)
		else:
			flag.remove(l)
			flag.remove(r)
		a[i + 1] = flag[0]
		count += 1
		flag = ['R', 'G', 'B']
print(count)
print(''.join(a))


n = int(input())
s = input() + '0'
s1 = s[0]
lst = s[0]
i = 1
j = 0
while i < n:
	if lst == s[i]:
		nxt = s[i + 1]
		if lst == 'R' and (nxt == 'R' or nxt == '0'):
			s1 += 'G'
			j += 1
		elif lst == 'R' and nxt == 'G':
			s1 += 'B'
			j += 1
		elif lst == 'R' and nxt == 'B':
			s1 += 'G'
			j += 1
		elif lst == 'G' and nxt == 'R':
			s1 += 'B'
			j += 1
		elif lst == 'G' and (nxt == 'G' or nxt == '0'):
			s1 += 'B'
			j += 1
		elif lst == 'G' and nxt == 'B':
			s1 += 'R'
			j += 1
		elif lst == 'B' and nxt == 'R':
			s1 += 'G'
			j += 1
		elif lst == 'B' and nxt == 'G':
			s1 += 'R'
			j += 1
		elif lst == 'B' and (nxt == 'B' or nxt == '0'):
			s1 += 'G'
			j += 1
		if s[i + 1] != '0':
			lst = s[i + 1]
			s1 += lst
		i += 2
	else:
		lst = s[i]
		i += 1
		s1 += lst
print(j)
print(s1)


_ = input()
s = input()
variants = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
best = ''
mindif = len(s) + 1
for i in variants:
	t = i * (len(s) // 3) + (i[:len(s) % 3] if len(s) % 3 != 0 else '')
	dif = 0
	for j in zip(s, t):
		if j[0] != j[1]:
			dif += 1
	if dif < mindif:
		best = t
		mindif = dif
print(mindif)
print(best)


n = int(input())
s = input()
a = ''
b = ''
c = ''
d = ''
e = ''
f = ''
i = 0
while i < n:
	if i % 3 == 0:
		a += 'R'
		b += 'R'
		c += 'B'
		d += 'B'
		e += 'G'
		f += 'G'
	if i % 3 == 1:
		a += 'G'
		b += 'B'
		c += 'R'
		d += 'G'
		e += 'R'
		f += 'B'
	if i % 3 == 2:
		a += 'B'
		b += 'G'
		c += 'G'
		d += 'R'
		e += 'B'
		f += 'R'
	i += 1
i = 0
aa = 0
bb = 0
cc = 0
dd = 0
ee = 0
ff = 0
while i < n:
	if a[i] != s[i]:
		aa += 1
	if b[i] != s[i]:
		bb += 1
	if c[i] != s[i]:
		cc += 1
	if d[i] != s[i]:
		dd += 1
	if e[i] != s[i]:
		ee += 1
	if f[i] != s[i]:
		ff += 1
	i += 1
ans = a
se = aa
if se > bb:
	se = bb
	ans = b
if se > cc:
	se = cc
	ans = c
if se > dd:
	se = dd
	ans = d
if se > ee:
	se = ee
	ans = e
if se > ff:
	se = ff
	ans = f
print(se)
print(ans)


n = int(input())
s = input()
min_change = 10 ** 10
answer = ''
for x1 in 'RGB':
	for x2 in 'RGB':
		for x3 in 'RGB':
			if x1 == x2 or x2 == x3 or x1 == x3:
				continue
			change = 0
			for idx in range(0, n, 3):
				if s[idx] != x1:
					change += 1
				if idx + 1 < n and s[idx + 1] != x2:
					change += 1
				if idx + 2 < n and s[idx + 2] != x3:
					change += 1
			if change < min_change:
				min_change = change
				answer = ''.join((x for x in [x1, x2, x3]))
print(min_change)
print(''.join((answer[idx % 3] for (idx, _) in enumerate(s))))


t = 1
j = 0
for i in range(10):
	j += 1
for _ in range(1):
	n = int(input())
	s = input()
	if n < 3:
		if n == 1:
			print(0)
			print(s)
			exit()
		if n == 2:
			if s[0] != s[1]:
				print(0)
				print(s)
			else:
				print(1)
				if s[0] == 'R':
					print('RG')
				elif s[0] == 'G':
					print('RG')
				elif s[0] == 'B':
					print('RB')
		exit()
	st1 = st2 = st3 = st4 = st5 = st6 = ''
	co1 = co2 = co3 = co4 = co5 = co6 = 0
	num = n // 3
	rem = n % 3
	for i in range(num):
		st1 += 'RGB'
		st2 += 'RBG'
		st3 += 'GRB'
		st4 += 'GBR'
		st5 += 'BRG'
		st6 += 'BGR'
	st1 += st1[:rem]
	st2 += st2[:rem]
	st3 += st3[:rem]
	st4 += st4[:rem]
	st5 += st5[:rem]
	st6 += st6[:rem]
	for i in range(n):
		if st1[i] != s[i]:
			co1 += 1
		if st2[i] != s[i]:
			co2 += 1
		if st3[i] != s[i]:
			co3 += 1
		if st4[i] != s[i]:
			co4 += 1
		if st5[i] != s[i]:
			co5 += 1
		if st6[i] != s[i]:
			co6 += 1
	mina = min(co6, co5, co4, co3, co2, co1)
	if mina == co1:
		print(co1)
		print(st1)
	elif mina == co2:
		print(co2)
		print(st2)
	elif mina == co3:
		print(co3)
		print(st3)
	elif mina == co4:
		print(co4)
		print(st4)
	elif mina == co5:
		print(co5)
		print(st5)
	elif mina == co6:
		print(co6)
		print(st6)


import sys
import math

def read_int():
	return int(input().strip())

def read_int_list():
	return list(map(int, input().strip().split()))

def read_string():
	return input().strip()

def read_string_list(delim=' '):
	return input().strip().split(delim)
n = read_int()
s = read_string()

def convert(s1, s2):
	cost = 0
	out = ''
	for i in range(len(s1)):
		if s1[i] == s2[i]:
			out += s2[i]
		else:
			out += s2[i]
			cost += 1
	return (cost, out)
possibles = ['RBG', 'RGB', 'GBR', 'GRB', 'BGR', 'BRG']
costs = [0] * 6
for p in range(6):
	temp = 0
	for i in range(0, n, 3):
		temp += convert(s[i:i + 3], possibles[p])[0]
	costs[p] = temp
mini_cost = min(costs)
nicest = ''
for i in range(6):
	if costs[i] == mini_cost:
		nicest = possibles[i]
		break
tot = 0
out = ''
for i in range(0, n, 3):
	rez = convert(s[i:i + 3], nicest)
	tot += rez[0]
	out += rez[1]
print(tot)
print(out)


n = int(input())
s = input()
possibilities = ['RGB', 'RBG', 'GBR', 'GRB', 'BGR', 'BRG']
(min_conflicts, winning_possibility) = (n, '')
for possibility in possibilities:
	(conflicts, j) = (0, 0)
	for i in range(n):
		if possibility[j] != s[i]:
			conflicts += 1
		j = (j + 1) % 3
	if conflicts < min_conflicts:
		min_conflicts = conflicts
		winning_possibility = possibility
print(str(min_conflicts) + '\n' + winning_possibility * (n // 3) + winning_possibility[0:n % 3])


n = int(input())
s = input()
s1 = 'RGB'
s2 = 'RBG'
s3 = 'BRG'
s4 = 'BGR'
s5 = 'GBR'
s6 = 'GRB'
s1 = 'RGB' * (n // 3) + s1[:n % 3]
s2 = 'RBG' * (n // 3) + s2[:n % 3]
s3 = 'BRG' * (n // 3) + s3[:n % 3]
s4 = 'BGR' * (n // 3) + s4[:n % 3]
s5 = 'GBR' * (n // 3) + s5[:n % 3]
s6 = 'GRB' * (n // 3) + s6[:n % 3]
arr = []
c = 0
for i in range(len(s)):
	if s[i] != s1[i]:
		c += 1
arr.append([c, s1])
c = 0
for i in range(len(s)):
	if s[i] != s2[i]:
		c += 1
arr.append([c, s2])
c = 0
for i in range(len(s)):
	if s[i] != s3[i]:
		c += 1
arr.append([c, s3])
c = 0
for i in range(len(s)):
	if s[i] != s4[i]:
		c += 1
arr.append([c, s4])
c = 0
for i in range(len(s)):
	if s[i] != s5[i]:
		c += 1
arr.append([c, s5])
c = 0
for i in range(len(s)):
	if s[i] != s6[i]:
		c += 1
arr.append([c, s6])
print(min(arr)[0])
print(min(arr)[1])


from itertools import permutations

def solve(s1):
	strr = str()
	ans1 = 0
	for i in range(n):
		if s[i] != s1[i % 3]:
			ans1 += 1
			strr += s1[i % 3]
		else:
			strr += s[i]
	return [ans1, strr]
n = int(input())
s = input()
ans = []
s1 = 'RGB'
for p in list(permutations(s1)):
	ans.append(solve(p))
ans = sorted(ans, key=lambda x: x[0])
print(ans[0][0])
print(ans[0][1])


n = int(input())
s = ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']
a = input()
minn = 10 ** 9
for i in range(6):
	cnt = 0
	temp = s[i] * (n // 3) + s[i][:n % 3]
	for j in range(n):
		if a[j] != temp[j]:
			cnt += 1
	if minn > cnt:
		minn = cnt
		ans = temp
print(minn, ans, sep='\n')


n = int(input())
S = input()
L = list(S) + [0]
compteur = 0
for i in range(1, n):
	if L[i - 1] == L[i]:
		compteur += 1
		L[i] = (set('RGB') - set(L[i:i + 2])).pop()
print(compteur, ''.join(L[:-1]))


n = int(input())
s = list(input())
if n == 1:
	print(0)
	print(s[0])
else:
	count = 0
	for i in range(n - 2):
		if s[i] == s[i + 1]:
			if s[i] == 'R':
				if s[i + 2] == 'B':
					s[i + 1] = 'G'
				else:
					s[i + 1] = 'B'
			elif s[i] == 'G':
				if s[i + 2] == 'R':
					s[i + 1] = 'B'
				else:
					s[i + 1] = 'R'
			elif s[i] == 'B':
				if s[i + 2] == 'G':
					s[i + 1] = 'R'
				else:
					s[i + 1] = 'G'
			count += 1
	if s[-1] == s[-2]:
		if s[-2] == 'R':
			s[-1] = 'G'
		elif s[-2] == 'G':
			s[-1] = 'B'
		else:
			s[-1] = 'R'
		count += 1
	print(count)
	print(''.join(s))


n = int(input())
s = input()
l = []
l.append(s[0])
j = 0
c = 0
if n == 1:
	print(0)
	print(s)
else:
	for i in range(1, len(s) - 1):
		if l[j] != s[i]:
			l.append(s[i])
			j = j + 1
		elif s[i] == l[j]:
			if s[i + 1] != s[i]:
				k = ['R', 'G', 'B']
				m = [s[i], s[i + 1]]
				g = [item for item in k if item not in m]
				l.append(g[0])
				j = j + 1
			elif s[i + 1] == s[i]:
				k = ['R', 'G', 'B']
				m = s[i]
				g = [item for item in k if item not in m]
				l.append(g[0])
				j = j + 1
			c = c + 1
	t = s[n - 1]
	if t != l[j]:
		l.append(t)
	else:
		k = ['R', 'G', 'B']
		m = [t]
		g = [item for item in k if item not in m]
		l.append(g[0])
		c = c + 1
	print(c)
	print(''.join(l))


n = int(input())
string = input()
count = 0
choose = ['R', 'B', 'G']
new = string[0]
for q in range(1, n):
	if q == n - 1:
		if string[q] == new[q - 1]:
			count += 1
			if string[q] == 'R':
				new += 'G'
			elif string[q] == 'G':
				new += 'B'
			elif string[q] == 'B':
				new += 'R'
		else:
			new += string[q]
	elif string[q] == new[q - 1]:
		count += 1
		if string[q] == string[q + 1]:
			if string[q] == 'R':
				new += 'G'
			elif string[q] == 'G':
				new += 'B'
			elif string[q] == 'B':
				new += 'R'
		elif string[q] == 'R' and string[q + 1] == 'B' or (string[q] == 'B' and string[q + 1] == 'R'):
			new += 'G'
		elif string[q] == 'G' and string[q + 1] == 'R' or (string[q] == 'R' and string[q + 1] == 'G'):
			new += 'B'
		elif string[q] == 'B' and string[q + 1] == 'G' or (string[q] == 'G' and string[q + 1] == 'B'):
			new += 'R'
	else:
		new += string[q]
print(count)
print(new)


n = int(input())
a = input()
a = list(a)
s = 0
c = {'R', 'G', 'B'}
if n == 1:
	print(0)
	print(a.pop())
	exit()
elif n == 2:
	if a[0] != a[1]:
		print(0)
		print(a[0] + a[1])
		exit()
	else:
		print(1)
		print(a[0] + (c - {a[1]}).pop())
		exit()
else:
	for i in range(n - 2):
		if a[i] != a[i + 1] and a[i + 1] != a[i + 2]:
			continue
		else:
			s += 1
			if a[i] == a[i + 1] == a[i + 2] or a[i] == a[i + 1]:
				a[i + 1] = (c - {a[i], a[i + 2]}).pop()
			elif a[i + 1] == a[i + 2]:
				try:
					a[i + 2] = (c - {a[i + 1], a[i + 3]}).pop()
				except:
					a[i + 2] = (c - {a[i + 1]}).pop()
	print(s)
	print(''.join((str(x) for x in a)))


n = int(input())
p = input().rstrip()
p = list(p)
if len(p) == 1:
	print(0)
	print(''.join(p))
else:
	l = [['R', 'G', 'B'], ['G', 'B', 'R'], ['G', 'R', 'B'], ['R', 'B', 'G'], ['B', 'R', 'G'], ['B', 'G', 'R']]
	w = []
	for j in range(0, len(l)):
		SS = 0
		for i in range(0, len(p)):
			if i % 3 == 0 and l[j][0] != p[i]:
				SS = SS + 1
			elif i % 3 == 1 and l[j][1] != p[i]:
				SS = SS + 1
			elif i % 3 == 2 and l[j][2] != p[i]:
				SS = SS + 1
		w.append(SS)
	T = min(w)
	C = w.index(T)
	S = []
	print(T)
	for i in range(0, len(p)):
		if i % 3 == 0:
			S.append(l[C][0])
		elif i % 3 == 1:
			S.append(l[C][1])
		elif i % 3 == 2:
			S.append(l[C][2])
	print(''.join(S))


n = int(input())
s = input()
patterns = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']

def str_diff(x, y):
	cost = 0
	for i in range(len(x)):
		if x[i] != y[i]:
			cost += 1
	return cost
min_diff = n
min_s = ''
for p in patterns:
	nice_s = p * (n // 3) + p[:n % 3]
	diff = str_diff(nice_s, s)
	if diff < min_diff:
		min_diff = diff
		min_s = nice_s
print(min_diff)
print(min_s)


import sys
import math

def read_int():
	return int(input().strip())

def read_int_list():
	return list(map(int, input().strip().split()))

def read_string():
	return input().strip()

def read_string_list(delim=' '):
	return input().strip().split(delim)
n = read_int()
s = read_string()
out = ''
if n == 1:
	print(0)
	print(s)
	sys.exit()
if n == 2:
	if s[0] != s[1]:
		print(0)
		print(s)
		sys.exit()
	elif s[0] == 'R':
		print(1)
		print('RG')
		sys.exit()
	elif s[0] == 'G':
		print(1)
		print('RG')
		sys.exit()
	elif s[0] == 'B':
		print(1)
		print('RB')
		sys.exit()
	else:
		pass
(first, second) = (0, 1)
cost = 0
out = ''
while second < n + 1:
	if second < n:
		if s[first] == s[second]:
			if second + 1 < n:
				next = s[second + 1]
				foo_set = set([s[first], next])
				rem = list(set(['R', 'B', 'G']).difference(foo_set))
				tbr = rem[0]
				out += s[first]
				out += tbr
				first += 2
				second += 2
				cost += 1
			elif s[first] == 'R':
				out += 'RG'
				cost += 1
				break
			elif s[first] == 'G':
				out += 'GR'
				cost += 1
				break
			else:
				out += 'BR'
				cost += 1
				break
		else:
			out += s[first]
			first += 1
			second += 1
	else:
		out += s[first]
		first += 1
		second += 1
print(cost)
print(out)


import sys, itertools
from heapq import heappop, heappush
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
n = inp()
s = list(input())
d = {'R': 0, 'G': 1, 'B': 2}
s = [d[x] for x in s]
res = INF
pat = []
for pt in itertools.permutations(range(3)):
	cnt = 0
	for (i, x) in enumerate(s):
		if x != pt[i % 3]:
			cnt += 1
	if cnt < res:
		res = cnt
		pat = pt
print(res)
for (i, x) in enumerate(s):
	if x != pat[i % 3]:
		s[i] = pat[i % 3]
d = {0: 'R', 1: 'G', 2: 'B'}
s = [d[x] for x in s]
print(''.join(s))


strLen = int(input())
pattern = input()

def checkAndUpdateMin(globalMin, globalPattern, minlen, minPattern):
	if globalMin > minlen:
		return (minlen, minPattern)
	else:
		return (globalMin, globalPattern)

def changeToPattern(changePattern, strLen, uPattern):
	count = 0
	resultStr = ''
	for i in range(0, strLen):
		if changePattern[i % 3] != uPattern[i]:
			count += 1
		resultStr += changePattern[i % 3]
	return (count, resultStr)

def handlePattern(strLen, pattern):
	(globalMin, globalPattern) = changeToPattern('RGB', strLen, pattern)
	(minlen2, rPattern2) = changeToPattern('RBG', strLen, pattern)
	(globalMin, globalPattern) = checkAndUpdateMin(globalMin, globalPattern, minlen2, rPattern2)
	(minlen3, rPattern3) = changeToPattern('GRB', strLen, pattern)
	(globalMin, globalPattern) = checkAndUpdateMin(globalMin, globalPattern, minlen3, rPattern3)
	(minlen4, rPattern4) = changeToPattern('GBR', strLen, pattern)
	(globalMin, globalPattern) = checkAndUpdateMin(globalMin, globalPattern, minlen4, rPattern4)
	(minlen5, rPattern5) = changeToPattern('BGR', strLen, pattern)
	(globalMin, globalPattern) = checkAndUpdateMin(globalMin, globalPattern, minlen5, rPattern5)
	(minlen6, rPattern6) = changeToPattern('BRG', strLen, pattern)
	(globalMin, globalPattern) = checkAndUpdateMin(globalMin, globalPattern, minlen6, rPattern6)
	return (globalMin, globalPattern)

def printResult(strLen, pattern):
	print(strLen)
	print(pattern)
if strLen == 1:
	printResult(0, str(pattern))
elif strLen == 2:
	if pattern[0] == pattern[1]:
		if pattern[0] == 'R':
			printResult(1, 'RG')
		elif pattern[0] == 'G':
			printResult(1, 'GB')
		else:
			printResult(1, 'BR')
	else:
		printResult(0, str(pattern))
elif strLen >= 3:
	(strRLen, rPattern) = handlePattern(strLen, pattern)
	printResult(strRLen, rPattern)


n = int(input())
s = str(input())
best = ''
best_dif = 999999999

def solve(s, salt):
	dif = 0
	for i in range(len(s)):
		if s[i] != salt[i % 3]:
			dif = dif + 1
	return dif
for salt in ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']:
	d = solve(s, salt)
	if d < best_dif:
		best_dif = d
		best = salt
import sys
print(best_dif)
for i in range(n):
	sys.stdout.write(best[i % 3])
sys.stdout.flush()


def div_process(s, c):
	sl = list(s)
	for i in range(1, len(sl), 2):
		sl[i] = c
	return ''.join(sl)
li = 0
ct = 0
input()
i_s = input()
sp_l = []
for i in range(1, len(i_s)):
	if not i_s[i] == i_s[i - 1]:
		sp_l.append(i_s[li:i])
		li = i
sp_l.append(i_s[li:])
for i in range(len(sp_l) - 1):
	sp_l[i] = div_process(sp_l[i], list({'R', 'G', 'B'} - {sp_l[i][0], sp_l[i + 1][0]})[0])
sp_l[-1] = div_process(sp_l[-1], list({'R', 'G', 'B'} - {sp_l[-1][0]})[0])
print(sum(map(lambda x: int(len(x) / 2), sp_l)))
print(''.join(sp_l))


n = int(input())
s = input()
dp = [[0 for i in range(3)] for j in range(n + 1)]
s1 = ''
s2 = ''
s3 = ''
l1 = [0 for i in range(n)]
for i in range(n):
	l1[i] = s[i]
for i in range(1, n + 1):
	if s[i - 1] == 'R':
		dp[i][0] = min(dp[i - 1][1], dp[i - 1][2])
		dp[i][1] = min(dp[i - 1][2], dp[i - 1][0]) + 1
		dp[i][2] = min(dp[i - 1][0], dp[i - 1][1]) + 1
		l = [dp[i][0], dp[i][1], dp[i][2]]
	elif s[i - 1] == 'B':
		dp[i][1] = min(dp[i - 1][0], dp[i - 1][2])
		dp[i][2] = min(dp[i - 1][1], dp[i - 1][0]) + 1
		dp[i][0] = min(dp[i - 1][1], dp[i - 1][2]) + 1
	elif s[i - 1] == 'G':
		dp[i][2] = min(dp[i - 1][0], dp[i - 1][1])
		dp[i][1] = min(dp[i - 1][0], dp[i - 1][2]) + 1
		dp[i][0] = min(dp[i - 1][1], dp[i - 1][2]) + 1
print(min(dp[n]))
r1 = min(dp[n])
for i in range(1, n - 1):
	if l1[i] == l1[i - 1]:
		if l1[i - 1] == l1[i + 1] and l1[i] != 'G':
			l1[i] = 'G'
		elif l1[i - 1] == l1[i + 1]:
			l1[i] = 'B'
		elif l1[i - 1] == 'B' and l1[i + 1] == 'R':
			l1[i] = 'G'
		elif l1[i - 1] == 'R' and l1[i + 1] == 'B':
			l1[i] = 'G'
		elif l1[i - 1] == 'B' and l1[i + 1] == 'G':
			l1[i] = 'R'
		elif l1[i - 1] == 'G' and l1[i + 1] == 'B':
			l1[i] = 'R'
		elif l1[i - 1] == 'R' and l1[i + 1] == 'G':
			l1[i] = 'B'
		elif l1[i - 1] == 'G' and l1[i + 1] == 'R':
			l1[i] = 'B'
if l1[n - 1] == l1[n - 2] and len(l1) > 1:
	if l1[n - 1] == 'G':
		l1[n - 1] = 'B'
	else:
		l1[n - 1] = 'G'
print(''.join(l1))


n = int(input())
arr = list(input())
r = 'R'
g = 'G'
b = 'B'
ac = 0
for i in range(1, n - 1):
	if arr[i - 1] == arr[i] == arr[i + 1]:
		if arr[i] == r:
			arr[i] = g
			ac += 1
		elif arr[i] == b:
			arr[i] = g
			ac += 1
		elif arr[i] == g:
			arr[i] = r
			ac += 1
	elif arr[i] == arr[i - 1]:
		if arr[i] == r and arr[i + 1] == g:
			arr[i] = b
			ac += 1
		elif arr[i] == b and arr[i + 1] == g:
			arr[i] = r
			ac += 1
		elif arr[i] == r and arr[i + 1] == b:
			arr[i] = g
			ac += 1
		elif arr[i] == b and arr[i + 1] == r:
			arr[i] = g
			ac += 1
		elif arr[i] == g and arr[i + 1] == r:
			arr[i] = b
			ac += 1
		elif arr[i] == g and arr[i + 1] == b:
			arr[i] = r
			ac += 1
if n >= 2:
	if arr[n - 1] == arr[n - 2]:
		i = n - 1
		if arr[i] == r:
			arr[i] = g
			ac += 1
		elif arr[i] == b:
			arr[i] = g
			ac += 1
		elif arr[i] == g:
			arr[i] = r
			ac += 1
print(ac)
for i in arr:
	print(i, end='')


n = int(input())
s = input()
a = [0, 0, 0, 0, 0, 0]
a1 = ['RGB', 'RBG', 'GRB', 'GBR', 'BGR', 'BRG']
j = 0
for i in s:
	for k in range(6):
		if a1[k][j] != i:
			a[k] += 1
	j = j + 1 if j < 2 else 0
print(min(a))
j = 0
for i in range(n):
	print(a1[a.index(min(a))][j], end='')
	j = j + 1 if j < 2 else 0


from itertools import combinations
from sys import stdin, stdout

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())
n = intIn()
s = stdin.readline()
s = list(s)
color = 'RGB'
ans = s
cnt = 0
for i in range(1, n):
	if ans[i - 1] == s[i]:
		cnt += 1
		if i < n - 1:
			if s[i] != s[i + 1]:
				if ans[i - 1] == s[i + 1]:
					if ans[i - 1] == 'R':
						ans[i] = 'G'
					else:
						ans[i] = 'R'
				elif ans[i - 1] == 'R':
					if s[i + 1] == 'G':
						ans[i] = 'B'
					else:
						ans[i] = 'G'
				elif ans[i - 1] == 'B':
					if s[i + 1] == 'R':
						ans[i] = 'G'
					else:
						ans[i] = 'R'
				elif s[i + 1] == 'B':
					ans[i] = 'R'
				else:
					ans[i] = 'B'
			elif s[i] == 'R':
				ans[i] = 'B'
			else:
				ans[i] = 'R'
		elif s[i] == 'R':
			ans[i] = 'G'
		else:
			ans[i] = 'R'
stdout.write(str(cnt) + '\n')
stdout.write(''.join(ans))


n = int(input())
s = input()
ss = s[0]

def ans(a, b):
	if a == 'R':
		if b == 'G':
			return 'B'
		else:
			return 'G'
	elif a == 'G':
		if b == 'R':
			return 'B'
		else:
			return 'R'
	elif b == 'R':
		return 'G'
	else:
		return 'R'
m = 0
for i in range(1, n - 1):
	if s[i] == ss[i - 1]:
		ss = ss + ans(s[i], s[i + 1])
		m += 1
	else:
		ss = ss + s[i]
if s[n - 1] == ss[len(ss) - 1]:
	m += 1
	ss = ss + ans(s[n - 1], s[n - 1])
else:
	ss = ss + s[n - 1]
if n == 1:
	print('0\n' + s)
else:
	print(m)
	print(ss)


from math import *
n = int(input())
s = list(map(str, input()))
t = 0
ot = 0
while t < len(s) - 2:
	if s[t] == s[t + 1]:
		if (s[t] == 'R' or s[t + 2] == 'R') and (s[t] == 'B' or s[t + 2] == 'B'):
			s[t + 1] = 'G'
			ot += 1
		elif (s[t] == 'R' or s[t + 2] == 'R') and (s[t] == 'G' or s[t + 2] == 'G'):
			s[t + 1] = 'B'
			ot += 1
		elif (s[t] == 'G' or s[t + 2] == 'G') and (s[t] == 'B' or s[t + 2] == 'B'):
			s[t + 1] = 'R'
			ot += 1
		elif s[t] == 'G' or s[t] == 'B':
			s[t + 1] = 'R'
			ot += 1
		else:
			s[t + 1] = 'G'
			ot += 1
	t += 1
if len(s) >= 2:
	if s[t] == s[t + 1]:
		if s[t] == 'G' or s[t] == 'B':
			s[t + 1] = 'R'
			ot += 1
		else:
			s[t + 1] = 'G'
			ot += 1
print(ot)
print(''.join(s))


import sys
import math

def getAndParseInt(num=1):
	string = sys.stdin.readline().strip()
	if num == 1:
		return int(string)
	else:
		return [int(part) for part in string.split()]

def getAndParseString(num=1, delim=' '):
	string = sys.stdin.readline().strip()
	if num == 1:
		return string
	else:
		return [part for part in string.split(delim)]
n = getAndParseInt()
lamps = list(getAndParseString())
char_ops = ['R', 'G', 'B']
index = 0
changes = 0
while index < n:
	block = index + 1
	char = lamps[index]
	while block < n and lamps[block] == char:
		block += 1
	length = block - index
	if length >= 2:
		changes += length // 2
		change_index = index + length % 2
		while change_index < block:
			neighs = []
			if change_index + 1 < n:
				neighs.append(lamps[change_index + 1])
			if change_index - 1 >= 0:
				neighs.append(lamps[change_index - 1])
			for op in char_ops:
				if op not in neighs:
					lamps[change_index] = op
			change_index += 2
	index = block
print(changes)
print(''.join(lamps))


n = int(input())
s = input()
a = []
b = [0] * 6
m = 0
a.append(''.join(['B' if x % 3 == 0 else 'G' if x % 3 == 1 else 'R' for x in range(n)]))
a.append(''.join(['B' if x % 3 == 0 else 'R' if x % 3 == 1 else 'G' for x in range(n)]))
a.append(''.join(['G' if x % 3 == 0 else 'R' if x % 3 == 1 else 'B' for x in range(n)]))
a.append(''.join(['G' if x % 3 == 0 else 'B' if x % 3 == 1 else 'R' for x in range(n)]))
a.append(''.join(['R' if x % 3 == 0 else 'G' if x % 3 == 1 else 'B' for x in range(n)]))
a.append(''.join(['R' if x % 3 == 0 else 'B' if x % 3 == 1 else 'G' for x in range(n)]))
for j in range(6):
	for i in range(n):
		if a[j][i] != s[i]:
			b[j] += 1
	if b[j] < b[m]:
		m = j
print(b[m])
print(a[m])


from operator import itemgetter
n = int(input())
s = input()
if n == 1:
	print(0)
	print(s)
else:
	(r1, r2, r3) = (0, 0, 0)
	(g1, g2, g3) = (0, 0, 0)
	(b1, b2, b3) = (0, 0, 0)
	for i in range(n):
		if i % 3 == 0:
			if s[i] == 'G':
				g1 += 1
			elif s[i] == 'R':
				r1 += 1
			else:
				b1 += 1
		elif i % 3 == 1:
			if s[i] == 'G':
				g2 += 1
			elif s[i] == 'R':
				r2 += 1
			else:
				b2 += 1
		elif s[i] == 'G':
			g3 += 1
		elif s[i] == 'R':
			r3 += 1
		else:
			b3 += 1
	arr = [0] * 6
	for i in range(6):
		arr[i] = [0] * 2
	arr[0][0] = 'rgb'
	arr[0][1] = g1 + b1 + r2 + b2 + r3 + g3
	arr[1][0] = 'rbg'
	arr[1][1] = g1 + b1 + r2 + g2 + r3 + b3
	arr[2][0] = 'grb'
	arr[2][1] = r1 + b1 + g2 + b2 + g3 + r3
	arr[3][0] = 'gbr'
	arr[3][1] = b1 + r1 + g2 + r2 + g3 + b3
	arr[4][0] = 'brg'
	arr[4][1] = r1 + g1 + b2 + g2 + b3 + r3
	arr[5][0] = 'bgr'
	arr[5][1] = g1 + r1 + b2 + r2 + g3 + b3
	arr = sorted(arr, key=itemgetter(1))
	if arr[0][1] == 0:
		print(arr[0][1])
		print(s)
	else:
		if arr[0][0] == 'rgb':
			print(arr[0][1])
			for i in range(n):
				if i % 3 == 0:
					print('R', end='')
				elif i % 3 == 1:
					print('G', end='')
				else:
					print('B', end='')
		elif arr[0][0] == 'rbg':
			print(arr[0][1])
			for i in range(n):
				if i % 3 == 0:
					print('R', end='')
				elif i % 3 == 1:
					print('B', end='')
				else:
					print('G', end='')
		elif arr[0][0] == 'gbr':
			print(arr[0][1])
			for i in range(n):
				if i % 3 == 0:
					print('G', end='')
				elif i % 3 == 1:
					print('B', end='')
				else:
					print('R', end='')
		elif arr[0][0] == 'grb':
			print(arr[0][1])
			for i in range(n):
				if i % 3 == 0:
					print('G', end='')
				elif i % 3 == 1:
					print('R', end='')
				else:
					print('B', end='')
		elif arr[0][0] == 'bgr':
			print(arr[0][1])
			for i in range(n):
				if i % 3 == 0:
					print('B', end='')
				elif i % 3 == 1:
					print('G', end='')
				else:
					print('R', end='')
		else:
			print(arr[0][1])
			for i in range(n):
				if i % 3 == 0:
					print('B', end='')
				elif i % 3 == 1:
					print('R', end='')
				else:
					print('G', end='')
		print()


n = int(input())
s = input()
ptr = 3
x = ['RGB', 'RBG', 'GRB', 'GBR', 'BGR', 'BRG']
(ans, ansS) = (n, '')
for base in x:
	tempAns = 0
	for i in range(n):
		if s[i] != base[i % 3]:
			tempAns += 1
	if tempAns < ans:
		(ans, ansS) = (tempAns, base)
print(ans)
for i in range(n):
	print(ansS[i % 3], end='')
print()


n = int(input())
s = input()
lst = [i.lower() for i in s]
a = ['rgb', 'rbg', 'bgr', 'brg', 'grb', 'gbr']
r = int(n / 3)
poss = [i * r for i in a]
re = n % 3
poss = [obj + a[i][:re] for (i, obj) in enumerate(poss)]
cnv_to_str = lambda s: [i for i in s]
poss = [cnv_to_str(strin) for strin in poss]

def diff(l1, l2):
	cnt = 0
	for (i, ob) in enumerate(l1):
		if ob != l2[i]:
			cnt += 1
	return cnt
(f_list, cnt) = ([], n + 1)
for i in poss:
	x = diff(i, lst)
	if x < cnt:
		f_list = i
		cnt = x
print(cnt)
s = ''.join(f_list)
print(s.upper())


n = int(input())
s = input()
p = [0] * 6
for i in range(0, n):
	if i % 3 == 0:
		if s[i] == 'R':
			p[2] += 1
			p[3] += 1
			p[4] += 1
			p[5] += 1
		elif s[i] == 'G':
			p[0] += 1
			p[1] += 1
			p[4] += 1
			p[5] += 1
		else:
			p[0] += 1
			p[1] += 1
			p[2] += 1
			p[3] += 1
	elif i % 3 == 1:
		if s[i] == 'R':
			p[0] += 1
			p[1] += 1
			p[3] += 1
			p[5] += 1
		elif s[i] == 'G':
			p[1] += 1
			p[2] += 1
			p[3] += 1
			p[4] += 1
		else:
			p[0] += 1
			p[2] += 1
			p[4] += 1
			p[5] += 1
	elif s[i] == 'R':
		p[0] += 1
		p[1] += 1
		p[2] += 1
		p[4] += 1
	elif s[i] == 'G':
		p[0] += 1
		p[2] += 1
		p[3] += 1
		p[5] += 1
	else:
		p[1] += 1
		p[3] += 1
		p[4] += 1
		p[5] += 1
mn = int(1000000000.0) + 7
min_idx = -1
for i in range(0, 6):
	if p[i] < mn:
		mn = p[i]
		min_idx = i
print(mn)
if min_idx == 0:
	for i in range(0, n):
		if i % 3 == 0:
			print('R', end='')
		elif i % 3 == 1:
			print('G', end='')
		else:
			print('B', end='')
elif min_idx == 1:
	for i in range(0, n):
		if i % 3 == 0:
			print('R', end='')
		elif i % 3 == 1:
			print('B', end='')
		else:
			print('G', end='')
elif min_idx == 2:
	for i in range(0, n):
		if i % 3 == 0:
			print('G', end='')
		elif i % 3 == 1:
			print('R', end='')
		else:
			print('B', end='')
elif min_idx == 3:
	for i in range(0, n):
		if i % 3 == 0:
			print('G', end='')
		elif i % 3 == 1:
			print('B', end='')
		else:
			print('R', end='')
elif min_idx == 4:
	for i in range(0, n):
		if i % 3 == 0:
			print('B', end='')
		elif i % 3 == 1:
			print('R', end='')
		else:
			print('G', end='')
else:
	for i in range(0, n):
		if i % 3 == 0:
			print('B', end='')
		elif i % 3 == 1:
			print('G', end='')
		else:
			print('R', end='')


N = int(input())
S = list(input() + '.')
cnt = 0
for i in range(1, N):
	if S[i] == S[i - 1]:
		cnt += 1
		for ch in 'RGB':
			if ch != S[i - 1] and ch != S[i + 1]:
				S[i] = ch
				break
print(cnt)
print(''.join(S[:-1]))


n = int(input())
s = list(input())
needs = ''
cnt = 0
if n < 3:
	if n == 1:
		print(0)
		print(''.join(s))
	elif n == 2:
		if s[0] == s[1]:
			if s[0] == 'G' or s[0] == 'B':
				s[1] = 'R'
			else:
				s[1] = 'G'
			print(1)
			print(''.join(s))
		else:
			print(0)
			print(''.join(s))
else:
	for i in range(1, n - 1):
		if s[i] == s[i - 1] == s[i + 1]:
			cnt += 1
			if s[i] == 'B' or s[i] == 'G':
				s[i] = 'R'
			else:
				s[i] = 'B'
	for i in range(1, n - 1):
		if not (s[i] != s[i - 1] and s[i] != s[i + 1]):
			cnt += 1
			ss = 'RGB'
			ss = ss.replace(s[i - 1], '')
			ss = ss.replace(s[i + 1], '')
			s[i] = ss
	print(cnt)
	print(''.join(s))


n = int(input())
min = 1000000
p = 0
s = input()
c = ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']
for j in range(6):
	ct = 0
	for i in range(n):
		if s[i] != c[j][i % 3]:
			ct += 1
	if min > ct:
		min = ct
		p = j
print(min)
for i in range(0, int(n / 3)):
	print(c[p], end='')
for i in range(0, n % 3):
	print(c[p][i], end='')


def gen(n):
	l = ['RGB', 'RBG', 'BGR', 'BRG', 'GRB', 'GBR']
	t = n // 3
	for i in range(6):
		l[i] = l[i] * t
		l[i] = l[i] + l[i][:n - 3 * t]
	return l

def diff(s, a, n):
	c = 0
	for i in range(n):
		if s[i] != a[i]:
			c += 1
	return c
n = int(input())
s = input()
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if s[0] == s[1]:
		print(1)
		print(s[0] + ('G' if s[0] != 'G' else 'R'))
	else:
		print(0)
		print(s)
else:
	a = gen(n)
	m = 1000000000
	for i in range(6):
		c = diff(s, a[i], n)
		m = min(m, c)
		if m == c:
			o = a[i]
	print(m, o, sep='\n')


import sys
import os
import collections
import math
n = int(input())
s = input()
R0 = 0
G0 = 0
B0 = 0
for i in range(0, n, 3):
	if s[i] == 'R':
		R0 += 1
	elif s[i] == 'G':
		G0 += 1
	elif s[i] == 'B':
		B0 += 1
R1 = 0
G1 = 0
B1 = 0
for i in range(1, n, 3):
	if s[i] == 'R':
		R1 += 1
	elif s[i] == 'G':
		G1 += 1
	elif s[i] == 'B':
		B1 += 1
R2 = 0
G2 = 0
B2 = 0
for i in range(2, n, 3):
	if s[i] == 'R':
		R2 += 1
	elif s[i] == 'G':
		G2 += 1
	elif s[i] == 'B':
		B2 += 1
_0 = math.ceil(n / 3)
_1 = math.ceil((n - 1) / 3)
_2 = math.ceil((n - 2) / 3)
A = []
A.append(_0 - R0 + _1 - G1 + _2 - B2)
A.append(_0 - R0 + _1 - B1 + _2 - G2)
A.append(_0 - G0 + _1 - B1 + _2 - R2)
A.append(_0 - G0 + _1 - R1 + _2 - B2)
A.append(_0 - B0 + _1 - R1 + _2 - G2)
A.append(_0 - B0 + _1 - G1 + _2 - R2)
INDEX = A.index(min(A))
s = list(s)
if INDEX == 0:
	for i in range(0, n, 3):
		s[i] = 'R'
	for i in range(1, n, 3):
		s[i] = 'G'
	for i in range(2, n, 3):
		s[i] = 'B'
elif INDEX == 1:
	for i in range(0, n, 3):
		s[i] = 'R'
	for i in range(1, n, 3):
		s[i] = 'B'
	for i in range(2, n, 3):
		s[i] = 'G'
elif INDEX == 2:
	for i in range(0, n, 3):
		s[i] = 'G'
	for i in range(1, n, 3):
		s[i] = 'B'
	for i in range(2, n, 3):
		s[i] = 'R'
elif INDEX == 3:
	for i in range(0, n, 3):
		s[i] = 'G'
	for i in range(1, n, 3):
		s[i] = 'R'
	for i in range(2, n, 3):
		s[i] = 'B'
elif INDEX == 4:
	for i in range(0, n, 3):
		s[i] = 'B'
	for i in range(1, n, 3):
		s[i] = 'R'
	for i in range(2, n, 3):
		s[i] = 'G'
elif INDEX == 5:
	for i in range(0, n, 3):
		s[i] = 'B'
	for i in range(1, n, 3):
		s[i] = 'G'
	for i in range(2, n, 3):
		s[i] = 'R'
print(min(A))
ans = ''
for i in s:
	ans += i
print(ans)


n = int(input())
p = ['R', 'G', 'B']
m = input()
lo = list(m)

def raz(c):
	c = list(c)
	k = 0
	for (i, j) in enumerate(c):
		if lo[i] != j:
			k += 1
	return k
boom = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
boom = list(map(lambda s: s * (n // 3) + s[:n % 3], boom))
xo = list(map(raz, boom))
pol = min(xo)
ans = boom[xo.index(pol)]
print(pol)
print(ans)


def change(x, y):
	l = ['R', 'G', 'B']
	for i in range(len(l)):
		if l[i] != x and l[i] != y:
			return l[i]
n = int(input())
s = input()
arr = []
f = s[0]
z = ''
for i in range(len(s)):
	if s[i] == f:
		z = z + s[i]
	else:
		f = s[i]
		arr.append(z)
		z = f
arr.append(z)
arr
c = 0
for (i, j) in enumerate(arr):
	if len(j) % 2 == 1 and len(j) > 2:
		x = list(j)
		for h in range(1, len(j), 2):
			x[h] = change(j[0], j[0])
			c = c + 1
		arr[i] = ''.join(x)
	else:
		x = list(j)
		for h in range(1, len(j), 2):
			if i + 1 < len(arr):
				x[h] = change(j[0], arr[i + 1][0])
				c = c + 1
			else:
				x[h] = change(j[0], j[0])
				c = c + 1
		arr[i] = ''.join(x)
print(c)
print(''.join(arr))


n = int(input())
s = list(input())
res = 0
dic = {'R': 0, 'G': 1, 'B': 2}
dic1 = ['R', 'G', 'B']
for i in range(1, n - 1):
	if s[i] == s[i - 1]:
		res += 1
		if s[i] == s[i + 1]:
			s[i] = dic1[(dic[s[i]] + 1) % 3]
		else:
			s[i] = dic1[3 - dic[s[i - 1]] - dic[s[i + 1]]]
if n >= 2 and s[-2] == s[-1]:
	res += 1
	s[-1] = 'G' if s[-1] != 'G' else 'B'
print(res)
print(''.join(s))


from sys import stdin, stdout
for _ in range(1):
	n = int(stdin.readline())
	s = input()
	mn = float('inf')
	ans = s
	prmts = ['RGB', 'RBG', 'GRB', 'GBR', 'BGR', 'BRG']
	for ss in prmts:
		c = sum((int(s[i] != ss[i % 3]) for i in range(n)))
		if c < mn:
			mn = c
			ans = ss
	print(mn)
	print(''.join([ans[i % 3] for i in range(n)]))


n = int(input())
s = input()
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if s[0] == s[1]:
		if s[0] == 'R':
			print(1)
			print('GR')
		elif s[0] == 'G':
			print(1)
			print('RG')
		else:
			print(1)
			print('BG')
	else:
		print(0)
		print(s)
else:
	st1 = 'RGB' * int(n / 3)
	st2 = 'RBG' * int(n / 3)
	st3 = 'GRB' * int(n / 3)
	st4 = 'GBR' * int(n / 3)
	st5 = 'BRG' * int(n / 3)
	st6 = 'BGR' * int(n / 3)
	rem = n % 3
	st1 += st1[:rem]
	st2 += st2[:rem]
	st3 += st3[:rem]
	st4 += st4[:rem]
	st5 += st5[:rem]
	st6 += st6[:rem]
	c1 = c2 = c3 = c4 = c5 = c6 = 0
	for i in range(n):
		if st1[i] != s[i]:
			c1 += 1
		if st2[i] != s[i]:
			c2 += 1
		if st3[i] != s[i]:
			c3 += 1
		if st4[i] != s[i]:
			c4 += 1
		if st5[i] != s[i]:
			c5 += 1
		if st6[i] != s[i]:
			c6 += 1
	d = {}
	d[c1] = st1
	d[c2] = st2
	d[c3] = st3
	d[c4] = st4
	d[c5] = st5
	d[c6] = st6
	m = min(c1, c2, c3, c4, c5, c6)
	print(m)
	print(d[m])


strLen = int(input())
uPattern = input()
i = 0
totChg = 0
rPattern = ''

def getRVal(val, nextVal):
	if nextVal == '':
		if val == 'R':
			return 'G'
		if val == 'G':
			return 'B'
		if val == 'B':
			return 'R'
	else:
		if val == 'R' and nextVal == 'G':
			return 'B'
		if val == 'R' and nextVal == 'B':
			return 'G'
		if val == 'B' and nextVal == 'R':
			return 'G'
		if val == 'B' and nextVal == 'G':
			return 'R'
		if val == 'G' and nextVal == 'R':
			return 'B'
		if val == 'G' and nextVal == 'B':
			return 'R'

def getChanged(val, pattern, nextVal):
	result = ''
	rVal = getRVal(val, nextVal)
	for x in range(0, len(pattern)):
		if x % 2 == 0:
			result += val
		else:
			result += rVal
	return result
while i < strLen - 1:
	if uPattern[i] == uPattern[i + 1]:
		start = i
		count = 1
		i += 1
		while i < strLen - 1 and uPattern[i] == uPattern[i + 1]:
			count += 1
			i += 1
		count += 1
		end = i
		cPattern = uPattern[start:end + 1]
		if i == strLen - 1:
			rPattern += getChanged(cPattern[0], cPattern, '')
		else:
			rPattern += getChanged(cPattern[0], cPattern, uPattern[end + 1])
		totChg += count // 2
	else:
		rPattern += uPattern[i]
	i += 1
if i != strLen:
	rPattern += uPattern[i]
print(totChg)
print(rPattern)


def func(s, w):
	count = 0
	for i in range(len(s)):
		old = s[i]
		j = i % 3
		s[i] = w[j]
		if s[i] != old:
			count += 1
	return (count, ''.join(s))
n = input()
s = input()
ways = ['RGB', 'RBG', 'BGR', 'BRG', 'GBR', 'GRB']
minn = None
mins = None
for w in ways:
	(m, s_) = func(list(s), w)
	if minn is None or minn > m:
		minn = m
		mins = s_
print(minn)
print(mins)


n = int(input())
s = [tmp for tmp in input().strip()]
r = 0
cs = set(['R', 'G', 'B'])
for i in range(1, n):
	if s[i] == s[i - 1]:
		if i == n - 1:
			s[i] = list(cs.difference(set([s[i - 1]])))[0]
			r += 1
		else:
			s[i] = list(cs.difference(set([s[i - 1], s[i + 1]])))[0]
			r += 1
print(r)
print(*s, sep='')


n = int(input())
g = list(input())
cnt = 0
for i in range(1, n):
	if g[i] == g[i - 1]:
		cnt += 1
		g[i] = (set('RGB') - set(g[i:i + 2])).pop()
print(cnt)
print(''.join(g))


n = int(input())
a = [*input(), 0]
cnt = 0
for i in range(1, n):
	if a[i] == a[i - 1]:
		cnt += 1
		a[i] = (set('RGB') - set(a[i:i + 2])).pop()
print(cnt, ''.join(a[:-1]), sep='\n')


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()
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()
a = list(s)
c = 0
for i in range(1, n):
	if a[i] == a[i - 1]:
		c = c + 1
		if i + 1 < n:
			if a[i] in ['R', 'G'] and a[i + 1] in ['R', 'G']:
				a[i] = 'B'
			elif a[i] in ['R', 'B'] and a[i + 1] in ['R', 'B']:
				a[i] = 'G'
			elif a[i] in ['B', 'G'] and a[i + 1] in ['B', 'G']:
				a[i] = 'R'
		elif a[i] == 'R':
			a[i] = 'G'
		elif a[i] == 'G':
			a[i] = 'B'
		else:
			a[i] = 'R'
b = ''.join(a)
print(c)
print(b)


n = int(input())
l = list(input())
pre = l[0]
count = int(1)
sum = int(0)
ans = []
for i in range(1, n):
	if l[i] == pre:
		count += 1
		if count % 2 == 0 and i + 1 != n:
			if l[i] == 'R':
				if l[i + 1] == 'G':
					l[i] = 'B'
				else:
					l[i] = 'G'
			elif l[i] == 'G':
				if l[i + 1] == 'R':
					l[i] = 'B'
				else:
					l[i] = 'R'
			elif l[i + 1] == 'R':
				l[i] = 'G'
			else:
				l[i] = 'R'
		elif count % 2 == 0 and i + 1 == n:
			if l[i] == 'R':
				l[i] = 'G'
			elif l[i] == 'B':
				l[i] = 'G'
			else:
				l[i] = 'R'
	else:
		if count % 2 == 0:
			sum += int(count / 2)
		else:
			sum += count // 2
		count = 1
		pre = l[i]
if count % 2 == 0:
	sum += int(count / 2)
else:
	sum += count // 2
print(sum)
for i in l:
	print(i, end='')


from itertools import permutations
n = int(input())
garland = input()
colors = 'RGB'
count = float('inf')
result = ''
for perm in permutations(colors):
	temp_result = ''
	temp_count = 0
	for i in range(len(garland)):
		temp_result += perm[i % 3]
		if temp_result[i] != garland[i]:
			temp_count += 1
	if temp_count < count:
		count = temp_count
		result = temp_result
print(count, result, sep='\n')


n = int(input())
s = list(input())
res = 0
for i in range(1, n):
	if i == n - 1:
		if s[i] == s[i - 1]:
			if s[i - 1] == 'R':
				s[i] = 'B'
				res += 1
			elif s[i - 1] == 'B':
				s[i] = 'G'
				res += 1
			elif s[i - 1] == 'G':
				s[i] = 'R'
				res += 1
		break
	if s[i] == s[i - 1]:
		if s[i - 1] == 'R':
			if s[i + 1] == 'G':
				s[i] = 'B'
				res += 1
			elif s[i + 1] == 'B':
				s[i] = 'G'
				res += 1
			elif s[i + 1] == 'R':
				s[i] = 'B'
				res += 1
		elif s[i - 1] == 'B':
			if s[i + 1] == 'R':
				s[i] = 'G'
				res += 1
			elif s[i + 1] == 'G':
				s[i] = 'R'
				res += 1
			elif s[i + 1] == 'B':
				s[i] = 'R'
				res += 1
		elif s[i - 1] == 'G':
			if s[i + 1] == 'R':
				s[i] = 'B'
				res += 1
			elif s[i + 1] == 'B':
				s[i] = 'R'
				res += 1
			elif s[i + 1] == 'G':
				s[i] = 'B'
				res += 1
print(res)
for j in s:
	print(j, end='')


n = int(input())
s = input()
p = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
per = n
for i in p:
	x = 0
	b = i * (n // 3) + i[:n % 3]
	for j in range(n):
		if b[j] != s[j]:
			x += 1
	if per >= x:
		per = x
		answer = b
print(per)
print(answer)


import sys
from itertools import cycle, permutations, islice
data = sys.stdin.read().splitlines()
n = int(data[0])
line = data[1]
func = lambda x: sum((ch1 != ch2 for (ch1, ch2) in zip(line, cycle(x))))
seed = min(permutations('RGB'), key=func)
print(func(seed))
print(''.join(islice(cycle(seed), n)))


n = int(input())
s = input()
m = 200001
c = 0
l = ['RGB', 'RBG', 'GBR', 'GRB', 'BGR', 'BRG']
cost = [0, 0, 0, 0, 0, 0]
for j in range(6):
	c = 0
	for i in range(n):
		r = i % 3
		if r == 0 and s[i] != l[j][0] or (r == 1 and s[i] != l[j][1]) or (r == 2 and s[i] != l[j][2]):
			c += 1
	if c < m:
		m = c
		ind = j
print(m)
for i in range(n):
	print(l[ind][i % 3], end='')


n = int(input())
s = list(input())
a = ['R', 'G', 'B']
b = ['R', 'B', 'G']
c = ['B', 'R', 'G']
x = ['B', 'G', 'R']
y = ['G', 'R', 'B']
z = ['G', 'B', 'R']
t = [a, b, c, x, y, z]
k = []
for j in t:
	ans = 0
	t = []
	t += s
	for i in range(0, n, 3):
		if s[i] != j[0]:
			t[i] = j[0]
			ans += 1
	for i in range(1, n, 3):
		if s[i] != j[1]:
			t[i] = j[1]
			ans += 1
	for i in range(2, n, 3):
		if s[i] != j[2]:
			t[i] = j[2]
			ans += 1
	k.append([ans, t])
k.sort()
print(k[0][0])
print(''.join(k[0][1]))


c = [['R', 'G', 'B'], ['R', 'B', 'G'], ['B', 'R', 'G'], ['B', 'G', 'R'], ['G', 'R', 'B'], ['G', 'B', 'R']]
s = [0] * 6
n = int(input())
a = input()
for i in range(6):
	for j in range(n):
		if a[j] != c[i][j % 3]:
			s[i] += 1
p = min(s)
i = s.index(p)
print(p)
for j in range(n):
	print(c[i][j % 3], end='')


l = input()
l = int(l)
s = input()
if l == 1:
	print(0)
	print(s)
else:
	s = list(s)
	ans = 0
	for i in range(1, l - 1):
		if s[i] == s[i - 1]:
			ans += 1
			if s[i] == 'R':
				if s[i + 1] == 'G':
					s[i] = 'B'
				else:
					s[i] = 'G'
			elif s[i] == 'G':
				if s[i + 1] == 'R':
					s[i] = 'B'
				else:
					s[i] = 'R'
			elif s[i] == 'B':
				if s[i + 1] == 'R':
					s[i] = 'G'
				else:
					s[i] = 'R'
	if s[l - 1] == s[l - 2]:
		if s[l - 2] == 'R':
			s[l - 1] = 'G'
		elif s[l - 2] == 'G':
			s[l - 1] = 'B'
		elif s[l - 2] == 'B':
			s[l - 1] = 'R'
		ans += 1
	print(ans)
	print(''.join(s))


import math

def next(ch):
	if ch == 'R':
		return 'G'
	if ch == 'G':
		return 'B'
	return 'R'
n = int(input())
s = input()
l = ['RBG', 'RGB', 'GRB', 'GBR', 'BGR', 'BRG']
min_l = 10000000
min_str = ''
i = 0
res = 0
res_str = ''
while i < len(s):
	ch = s[i]
	res_str += s[i]
	i += 1
	j = i
	while i < len(s) and s[i] == ch:
		i += 1
	new_col = next(ch)
	if i < len(s) and s[i] == new_col:
		new_col = next(new_col)
	for k in range(j, i):
		if (k - j) % 2 == 0:
			res_str += new_col
			res += 1
		else:
			res_str += ch
print(res)
print(res_str)


from itertools import permutations

def difi(a, b):
	if a != 'R' and b != 'R':
		return 'R'
	if a != 'G' and b != 'G':
		return 'G'
	return 'B'
n = int(input())
lamps = list(input().strip())
res = 0
for i in range(1, n - 1):
	if lamps[i] == lamps[i - 1]:
		lamps[i] = difi(lamps[i + 1], lamps[i - 1])
		res += 1
if n > 1:
	if lamps[-1] == lamps[-2]:
		lamps[-1] = difi(lamps[-2], lamps[-2])
		res += 1
print(res)
print(''.join(lamps))


l = ['R', 'G', 'B']
n = int(input())
s = str(input())
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if s[0] == s[1]:
		print(1)
		x = s[0]
		for i in l:
			if i != s[0]:
				x += i
				break
		print(x)
	else:
		print(0)
		print(s)
else:
	count = 0
	ans = s[0]
	for i in range(1, len(s)):
		if s[i] == ans[i - 1]:
			count += 1
			if i != len(s) - 1:
				for j in l:
					if j != s[i] and j != s[i + 1]:
						ans += j
						break
			else:
				for j in l:
					if j != s[i]:
						ans += j
						break
		else:
			ans += s[i]
	print(count)
	print(ans)


import sys
n = int(sys.stdin.readline())
s = [tmp for tmp in sys.stdin.readline().rstrip()] + ['R']
dfc = {'R': 1, 'G': 2, 'B': 4}
dtc = {2: 'G', 3: 'B', 4: 'B', 5: 'G', 6: 'R', 8: 'R'}
r = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		r += 1
		s[i] = dtc[dfc[s[i - 1]] + dfc[s[i + 1]]]
print(r)
print(*s[:-1], sep='')


from sys import stdin
input = stdin.readline
(n, s, cnt) = (int(input()), [*input()], 0)
for i in range(1, n):
	if s[i] == s[i - 1]:
		s[i] = (set('RGB') - set(s[i:i + 2])).pop()
		cnt += 1
print(cnt, ''.join(s))


from itertools import *
n = int(input())
s = input().strip()

def diff(a, b):
	return sum(map(lambda x: x[0] != x[1], zip(a, b)))
d = 1e309
for c in permutations('RGB', 3):
	dd = 0
	for i in range(0, n, 3):
		dd += diff(s[i:i + 3], c)
	if dd < d:
		d = dd
		ss = ''.join(repeat(''.join(c), n // 3 + 1))[:n]
print(d, ss)


n = int(input())
l = input()
rg = ''
rb = ''
gr = ''
gb = ''
br = ''
bg = ''
c = [0] * 6
for i in range(n):
	if i % 3 == 0:
		rg = rg + 'R'
		rb = rb + 'R'
		gr = gr + 'G'
		gb = gb + 'G'
		br = br + 'B'
		bg = bg + 'B'
	elif i % 3 == 1:
		rg = rg + 'G'
		rb = rb + 'B'
		gr = gr + 'R'
		gb = gb + 'B'
		br = br + 'R'
		bg = bg + 'G'
	else:
		rg = rg + 'B'
		rb = rb + 'G'
		gr = gr + 'B'
		gb = gb + 'R'
		br = br + 'G'
		bg = bg + 'R'
for i in range(n):
	if rg[i] != l[i]:
		c[0] = c[0] + 1
	if rb[i] != l[i]:
		c[1] = c[1] + 1
	if gr[i] != l[i]:
		c[2] = c[2] + 1
	if gb[i] != l[i]:
		c[3] = c[3] + 1
	if br[i] != l[i]:
		c[4] = c[4] + 1
	if bg[i] != l[i]:
		c[5] = c[5] + 1
y = min(c)
z = c.index(y)
r = ''
if z == 0:
	r = rg
elif z == 1:
	r = rb
elif z == 2:
	r = gr
elif z == 3:
	r = gb
elif z == 4:
	r = br
else:
	r = bg
print(y)
print(r)


def get(s1, s2):
	if s1 == 'R':
		if s2 == 'R':
			return 'B'
		if s2 == 'G':
			return 'B'
		if s2 == 'B':
			return 'G'
	if s1 == 'B':
		if s2 == 'B':
			return 'R'
		if s2 == 'G':
			return 'R'
		if s2 == 'R':
			return 'G'
	if s1 == 'G':
		if s2 == 'G':
			return 'R'
		if s2 == 'R':
			return 'B'
		if s2 == 'B':
			return 'R'

def Diverse(L):
	c = 0
	for i in range(1, len(L)):
		if i == len(L) - 1:
			if L[i] == L[i - 1]:
				c = c + 1
				if L[i] == 'R':
					L[i] = 'B'
				elif L[i] == 'B':
					L[i] = 'R'
				else:
					L[i] = 'R'
		if L[i] == L[i - 1]:
			c = c + 1
			L[i] = get(L[i - 1], L[i + 1])
	s = ''
	for i in range(len(L)):
		s = s + L[i]
	return (c, s)
x = int(input(''))
s = input('')
x = (0, s)
x = Diverse(list(s))
print(x[0])
print(x[1])


import sys
from itertools import permutations
n = int(input())
s = input()
D = [[0, 0, 0] for l in range(n)]

def get_price(st, color):
	if st != color:
		return 1
	else:
		return 0
D[0][0] = get_price(s[0], 'R')
D[0][1] = get_price(s[0], 'G')
D[0][2] = get_price(s[0], 'B')
for i in range(1, n):
	D[i][0] = min(D[i - 1][1], D[i - 1][2]) + get_price(s[i], 'R')
	D[i][1] = min(D[i - 1][0], D[i - 1][2]) + get_price(s[i], 'G')
	D[i][2] = min(D[i - 1][1], D[i - 1][0]) + get_price(s[i], 'B')
print(min(D[n - 1][0], D[n - 1][1], D[n - 1][2]))
colors = 'RGB'
l = D[n - 1].index(min(D[n - 1]))
st = colors[l]
for i in range(n - 2, -1, -1):
	if l == 0:
		l = 1 if D[i][1] < D[i][2] else 2
	elif l == 1:
		l = 0 if D[i][0] < D[i][2] else 2
	else:
		l = 1 if D[i][1] < D[i][0] else 0
	st += colors[l]
print(''.join(list(reversed(st))))


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from itertools import combinations, permutations
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())

def change(s, x):
	if x == len(s) - 1:
		for i in 'RGB':
			if i != s[x - 1]:
				s[x] = i
				return
	for i in 'RGB':
		if i != s[x - 1] and i != s[x + 1]:
			s[x] = i
			break
n = ii()
s = list(ip())
c = 0
for i in range(n - 1):
	if s[i] == s[i + 1]:
		change(s, i + 1)
		c += 1
print(c)
print(''.join(s))


import itertools as it
n = int(input())
A = input()
best_val = len(A)
best = []
for perm in it.permutations('RGB'):
	res = 0
	for i in range(len(A)):
		if A[i] != perm[i % 3]:
			res += 1
	if res < best_val:
		best_val = res
		best = perm * (len(A) // 3) + perm[:len(A) % 3]
print(best_val)
print(''.join(best))


(n, s) = (int(input()), list(input()))
colors = list('RGB')
cnt = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		clr = colors[:]
		clr.remove(s[i - 1])
		if i < n - 1 and s[i + 1] in clr:
			clr.remove(s[i + 1])
		s[i] = clr[0]
		cnt += 1
print(cnt)
print(''.join(s))


from os import path
import sys, time, collections as c, math as m, pprint as p
(maxx, localsys, mod) = (float('inf'), 0, int(1000000000.0 + 7))
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
input = sys.stdin.readline
n = int(input())
s = list(input().rstrip('\n'))
(ans, tp) = (0, ['R', 'G', 'B'])
if n == 2 and s[0] == s[1]:
	(print(1, s[0] + tp[(tp.index(s[0]) + 1) % 3], sep='\n'), exit())
if n == 2:
	(print(0, ''.join(s), sep='\n'), exit())
for i in range(1, n - 1):
	if s[i - 1] == s[i] == s[i + 1]:
		if s[i] == 'R':
			s[i] = 'G'
		elif s[i] == 'G':
			s[i] = 'B'
		else:
			s[i] = 'R'
		ans += 1
	elif s[i - 1] == s[i]:
		x = s[i - 1]
		if i + 1 < n:
			x = s[i + 1]
		f = [1] * 3
		for t in [s[i], x]:
			f[tp.index(t)] = 0
		for k in range(3):
			if f[k]:
				s[i] = tp[k]
				break
		ans += 1
	elif s[i] == s[i + 1]:
		x = s[i + 1]
		if i + 2 < n:
			x = s[i + 2]
		f = [1] * 3
		for t in [s[i], x]:
			f[tp.index(t)] = 0
		for k in range(3):
			if f[k]:
				s[i + 1] = tp[k]
				break
		ans += 1
print(ans, ''.join(s), sep='\n')


def main():
	n = int(input())
	garland = [x for x in input().strip()]
	repaints = 0
	for i in range(1, len(garland)):
		if garland[i - 1] != garland[i]:
			garland[i] = garland[i]
			continue
		repaints += 1
		if i == len(garland) - 1:
			garland[i] = 'R' if garland[i - 1] != 'R' else 'B'
			continue
		if garland[i - 1] == garland[i + 1]:
			garland[i] = 'R' if garland[i + 1] != 'R' else 'B'
			continue
		if garland[i - 1] != 'R' and garland[i + 1] != 'R':
			garland[i] = 'R'
		elif garland[i - 1] != 'B' and garland[i + 1] != 'B':
			garland[i] = 'B'
		else:
			garland[i] = 'G'
	print(repaints)
	print(''.join(garland))
main()


from sys import stdin, stdout
input = stdin.readline
print = stdout.write
n = int(input())
s = list(input())
rgb = {'R', 'G', 'B'}
c = 0
prev = 0
for i in range(n):
	if prev:
		s[i] = rgb.difference([s[i - 1], s[i + 1] if i != n - 1 else '']).pop()
		prev = 0
		c += 1
	elif s[i] == (s[i + 1] if i != n - 1 else ''):
		prev = 1
print(str(c) + '\n')
print(''.join(s))


import sys
import math
import collections
import bisect
import string

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(1):
	n = int(input())
	string = list(get_string())
	ans = ''
	poss = ['RGB', 'RBG', 'BGR', 'BRG', 'GRB', 'GBR']
	cost = 10 ** 10
	for i in range(6):
		comp = n // 3
		char = list(poss[i])
		sub_string = char * comp
		rem = n % 3
		for j in range(rem):
			sub_string += char[j]
		c = 0
		for j in range(n):
			if sub_string[j] != string[j]:
				c += 1
		if c < cost:
			cost = c
			ans = sub_string
	print(cost)
	print(*ans, sep='')


n = int(input())
s = list(str(input()))
cur = s[0]
cnt = 0
X = []
for i in range(n):
	if s[i] == cur:
		cnt += 1
	else:
		X.append((cur, cnt))
		cnt = 1
		cur = s[i]
else:
	if cnt:
		X.append((cur, cnt))
ans = []
m = len(X)
res = 0
for i in range(m):
	(c, cnt) = X[i]
	if cnt == 1:
		ans += c
	else:
		temp = []
		res += cnt // 2
		if i != m - 1:
			if c == 'R':
				if X[i + 1][0] == 'B':
					t = 'G'
				else:
					t = 'B'
			elif c == 'G':
				if X[i + 1][0] == 'R':
					t = 'B'
				else:
					t = 'R'
			elif X[i + 1][0] == 'G':
				t = 'R'
			else:
				t = 'G'
		elif c == 'R':
			t = 'G'
		elif c == 'G':
			t = 'B'
		else:
			t = 'R'
		temp = []
		for j in range(cnt):
			if j % 2 == 0:
				temp.append(c)
			else:
				temp.append(t)
		ans.append(''.join(temp))
print(res)
print(''.join(ans))


n = int(input())
st = list(input())
sum = 0
if n > 1:
	for i in range(1, n - 1):
		lis = ['R', 'G', 'B']
		if st[i - 1] == st[i]:
			if st[i] == st[i + 1]:
				lis.remove(st[i])
				st[i] = lis[0]
				sum += 1
			else:
				lis.remove(st[i + 1])
				lis.remove(st[i - 1])
				st[i] = lis[0]
				sum += 1
	if st[-2] == st[-1]:
		lis = ['R', 'G', 'B']
		sum += 1
		lis.remove(st[-2])
		st[-1] = lis[0]
print(str(sum) + '\n' + ''.join(st))


n = int(input())
s = input()
t = s[:3]
r = 'RBG'
r1 = 'RGB'
r2 = 'BRG'
r3 = 'BGR'
r4 = 'GRB'
r5 = 'GBR'
a = []
count = 0
for i in range(min(3, n)):
	if s[i] != r[i]:
		count += 1
for i in range(3, n):
	if (i - 3) % 3 == 0 and s[i] != 'R':
		count += 1
	if (i - 4) % 3 == 0 and s[i] != 'B':
		count += 1
	if (i - 5) % 3 == 0 and s[i] != 'G':
		count += 1
a.append(count)
count = 0
for i in range(min(3, n)):
	if s[i] != r1[i]:
		count += 1
for i in range(3, n):
	if (i - 3) % 3 == 0 and s[i] != 'R':
		count += 1
	if (i - 4) % 3 == 0 and s[i] != 'G':
		count += 1
	if (i - 5) % 3 == 0 and s[i] != 'B':
		count += 1
a.append(count)
count = 0
for i in range(min(3, n)):
	if s[i] != r2[i]:
		count += 1
for i in range(3, n):
	if (i - 3) % 3 == 0 and s[i] != 'B':
		count += 1
	if (i - 4) % 3 == 0 and s[i] != 'R':
		count += 1
	if (i - 5) % 3 == 0 and s[i] != 'G':
		count += 1
a.append(count)
count = 0
for i in range(min(3, n)):
	if s[i] != r3[i]:
		count += 1
for i in range(3, n):
	if (i - 3) % 3 == 0 and s[i] != 'B':
		count += 1
	if (i - 4) % 3 == 0 and s[i] != 'G':
		count += 1
	if (i - 5) % 3 == 0 and s[i] != 'R':
		count += 1
a.append(count)
count = 0
for i in range(min(3, n)):
	if s[i] != r4[i]:
		count += 1
for i in range(3, n):
	if (i - 3) % 3 == 0 and s[i] != 'G':
		count += 1
	if (i - 4) % 3 == 0 and s[i] != 'R':
		count += 1
	if (i - 5) % 3 == 0 and s[i] != 'B':
		count += 1
a.append(count)
count = 0
for i in range(min(3, n)):
	if s[i] != r5[i]:
		count += 1
for i in range(3, n):
	if (i - 3) % 3 == 0 and s[i] != 'G':
		count += 1
	if (i - 4) % 3 == 0 and s[i] != 'B':
		count += 1
	if (i - 5) % 3 == 0 and s[i] != 'R':
		count += 1
a.append(count)
min = 100000000000
c = 0
for i in range(6):
	if a[i] < min:
		min = a[i]
		c = i
if c == 0:
	print(min)
	print(r * (n // 3) + r[:n % 3])
elif c == 1:
	print(min)
	print(r1 * (n // 3) + r1[:n % 3])
elif c == 2:
	print(min)
	print(r2 * (n // 3) + r2[:n % 3])
elif c == 3:
	print(min)
	print(r3 * (n // 3) + r3[:n % 3])
elif c == 4:
	print(min)
	print(r4 * (n // 3) + r4[:n % 3])
elif c == 5:
	print(min)
	print(r5 * (n // 3) + r5[:n % 3])


n = int(input())
s = str(input())
a1 = 'RGB'
a2 = 'RBG'
a3 = 'BGR'
a4 = 'BRG'
a5 = 'GRB'
a6 = 'GBR'
a11 = 0
a22 = 0
a33 = 0
a44 = 0
a55 = 0
a66 = 0
for i in range(n):
	x = i % 3
	if s[i] != a1[x]:
		a11 += 1
	if s[i] != a2[x]:
		a22 += 1
	if s[i] != a3[x]:
		a33 += 1
	if s[i] != a4[x]:
		a44 += 1
	if s[i] != a5[x]:
		a55 += 1
	if s[i] != a6[x]:
		a66 += 1
temp = [a11, a22, a33, a44, a55, a66]
m = min(temp)
ind = temp.index(m) + 1
print(m)
if ind == 1:
	for i in range(n):
		x = i % 3
		print(a1[x], end='')
elif ind == 2:
	for i in range(n):
		x = i % 3
		print(a2[x], end='')
elif ind == 3:
	for i in range(n):
		x = i % 3
		print(a3[x], end='')
elif ind == 4:
	for i in range(n):
		x = i % 3
		print(a4[x], end='')
elif ind == 5:
	for i in range(n):
		x = i % 3
		print(a5[x], end='')
elif ind == 6:
	for i in range(n):
		x = i % 3
		print(a6[x], end='')


from collections import Counter, defaultdict, deque
from math import factorial as fact

def primes(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return factors

def issubseq(s, t):
	if len(t) > len(s):
		return False
	lt = len(t)
	p = 0
	for el in s:
		if el == t[p]:
			p += 1
		if p == lt:
			return True
	return False
n = int(input())
s = [x for x in input()]
news = s[0]
c = 0
for i in range(1, n - 1):
	if s[i] != s[i - 1]:
		continue
	colors = {'R', 'G', 'B'}
	colors.discard(s[i])
	colors.discard(s[i + 1])
	s[i] = colors.pop()
	c += 1
if len(s) > 1 and s[-2] == s[-1]:
	colors = {'R', 'G', 'B'}
	colors.discard(s[-2])
	s[-1] = colors.pop()
	c += 1
print(c)
print(*s, sep='')


n = int(input())
a = list((ord(i) for i in input()))
k = 0
if n == 2:
	if a[0] != a[1]:
		print(0)
		print(chr(a[0]), chr(a[1]), sep='')
	else:
		print(1)
		if a[0] == 71 or a[0] == 82:
			print(chr(a[0]), chr(66), sep='')
		else:
			print(chr(a[0]), chr(71), sep='')
	exit()
for i in range(1, n - 1):
	if a[i - 1] == a[i] or a[i] == a[i + 1]:
		k += 1
		if a[i - 1] != a[i + 1]:
			if i != n - 2:
				if a[i] == a[i + 2]:
					if a[i] == 66 or a[i] == 82:
						a[i + 1] = 71
					else:
						a[i + 1] = 82
				else:
					a[i] = 219 - a[i - 1] - a[i + 1]
			else:
				a[i] = 219 - a[i - 1] - a[i + 1]
		elif a[i - 1] == 66 or a[i - 1] == 71:
			a[i] = 82
		else:
			a[i] = 66
print(k)
for i in a:
	print(chr(i), end='')
print()


def dic(s, C):
	n = len(s)
	ans = {0: 0, 1: 0, 2: 0}
	for i in range(0, n, 3):
		if s[i] == C:
			ans[0] += 1
	for i in range(1, n, 3):
		if s[i] == C:
			ans[1] += 1
	for i in range(2, n, 3):
		if s[i] == C:
			ans[2] += 1
	return ans
n = int(input())
s = input()
R = dic(s, 'R')
G = dic(s, 'G')
B = dic(s, 'B')
pattern = ''
steps = float('inf')
for r in {0, 1, 2}:
	for g in {0, 1, 2} - {r}:
		for b in {0, 1, 2} - {r} - {g}:
			for_r = len([i for i in range(r, n, 3)]) - R[r]
			for_g = len([i for i in range(g, n, 3)]) - G[g]
			for_b = len([i for i in range(b, n, 3)]) - B[b]
			curr_steps = for_r + for_g + for_b
			if curr_steps < steps:
				steps = curr_steps
				l = [None] * 3
				l[r] = 'R'
				l[g] = 'G'
				l[b] = 'B'
				pattern = ''.join(l)
comp = n // 3
rem = n % 3
print(steps)
print(pattern * comp + pattern[:rem])


import sys

def fprint(x):
	print(x, flush=True)

def qprint(x):
	sys.stdout.write(str(x) + '\n')

def input():
	return sys.stdin.readline()
n = int(input())
garland = input()
r_pos = []
g_pos = []
b_pos = []
for (index, letter) in enumerate(garland):
	if letter == 'R':
		r_pos.append(index)
	elif letter == 'G':
		g_pos.append(index)
	elif letter == 'B':
		b_pos.append(index)
list_perm = [[0, 1, 2], [0, 2, 1], [1, 2, 0], [1, 0, 2], [2, 1, 0], [2, 0, 1]]
min_changes = 1000000000.0
min_perm = None
for item in list_perm:
	count = 0
	for num in r_pos:
		if (num - item[0]) % 3 != 0:
			count += 1
	for num in g_pos:
		if (num - item[1]) % 3 != 0:
			count += 1
	for num in b_pos:
		if (num - item[2]) % 3 != 0:
			count += 1
	if count < min_changes:
		min_changes = count
		min_perm = item
print(min_changes)
to_print = ['B', 'B', 'B']
to_print[min_perm[0]] = 'R'
to_print[min_perm[1]] = 'G'
for i in range(n):
	print(to_print[i % 3], end='')
print('')


num = int(input().strip())
string = input().strip()
if num == 1:
	print(0)
	print(string)
else:
	ans = [0 for i in range(num)]
	for (n, i) in enumerate(range(1, num), 1):
		if string[i] == string[i - 1]:
			if i >= 2 and string[i] == string[i - 2]:
				if ans[i - 1] == ans[i - 2]:
					ans[i] = ans[i - 1] + 1
				else:
					ans[i] = ans[i - 1]
			else:
				ans[i] = ans[i - 1] + 1
		else:
			ans[n] = ans[n - 1]
	ans_s = [string[0]]
	letter = ['R', 'B', 'G']
	for i in range(1, num - 1):
		if ans[i] != ans[i - 1]:
			for j in letter:
				if j != string[i - 1] and j != string[i + 1]:
					ans_s.append(j)
					break
		else:
			ans_s.append(string[i])
	if ans[-1] != ans[-2]:
		for j in letter:
			if j != string[-2]:
				ans_s.append(j)
				break
	else:
		ans_s.append(string[-1])
	print(ans[-1])
	print(''.join(ans_s))


from collections import Counter
import string
import math
import sys
from fractions import Fraction
from itertools import product

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))

def printDivisors(n):
	divisors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				divisors.append(i)
			else:
				divisors.extend((i, n // i))
		i = i + 1
	return divisors

def countTotalBits(num):
	binary = bin(num)[2:]
	return len(binary)

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
mod = 10 ** 9 + 7

def comp(x):
	return x[1]

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			primes.append(p)
primes = []

def lcm(a, b):
	return a * b // math.gcd(a, b)

def primeFactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n = n // i
	if n > 2:
		factors.append(n)
	return factors
mod = 10 ** 9 + 7
testCases = 1
for _ in range(testCases):
	n = vary(1)
	s = input()
	values = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
	mini = float('inf')
	count = 0
	ans = []
	val = []
	for i in values:
		for j in range(n):
			if i[j % 3] != s[j]:
				count += 1
			ans.append(i[j % 3])
		if mini > count:
			mini = count
			val = ans[:]
		count = 0
		ans = []
	print(mini)
	print(*val, sep='')


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))


n = int(input())
a = list(input())
count = 0
chill = 0
if n == 1:
	chill = 1
if n == 2:
	if a[0] == a[1]:
		count += 1
		if a[0] == 'R':
			a[1] = 'G'
		elif a[1] == 'G':
			a[1] = 'R'
		else:
			a[1] = 'R'
	chill = 1
for i in range(n - 2):
	if chill == 1:
		break
	if a[i] == a[i + 1] and a[i + 1] == a[i + 2]:
		if a[i] == 'R':
			a[i + 1] = 'G'
		elif a[i] == 'G':
			a[i + 1] = 'R'
		else:
			a[i + 1] = 'R'
		count += 1
for i in range(n - 1):
	if chill == 1:
		break
	if a[i] == a[i + 1]:
		if i == 0:
			if a[i] == 'R' and a[i + 2] == 'B':
				a[i + 1] = 'G'
			elif a[i] == 'G' and a[i + 2] == 'R':
				a[i + 1] = 'B'
			elif a[i] == 'B' and a[i + 2] == 'G':
				a[i + 1] = 'R'
			elif a[i] == 'B' and a[i + 2] == 'R':
				a[i + 1] = 'G'
			elif a[i] == 'R' and a[i + 2] == 'G':
				a[i + 1] = 'B'
			else:
				a[i + 1] = 'R'
		elif a[i - 1] == 'R' and a[i + 1] == 'B':
			a[i] = 'G'
		elif a[i - 1] == 'G' and a[i + 1] == 'R':
			a[i] = 'B'
		elif a[i - 1] == 'B' and a[i + 1] == 'G':
			a[i] = 'R'
		elif a[i - 1] == 'B' and a[i + 1] == 'R':
			a[i] = 'G'
		elif a[i - 1] == 'R' and a[i + 1] == 'G':
			a[i] = 'B'
		else:
			a[i] = 'R'
		count += 1
print(count)
print(''.join(a))


input()
garland = list(input())
s_types = ['R', 'G', 'B']
res = 0
previous = garland[0]
for (ind, s) in enumerate(garland[1:-1]):
	if s == previous:
		res += 1
		for c in s_types:
			if c != garland[ind + 2] and c != previous:
				garland[ind + 1] = c
				previous = c
				break
	else:
		previous = s
if len(garland) > 1:
	if garland[-2] == garland[-1]:
		res += 1
		s = garland[-2]
		for c in s_types:
			if c != s:
				garland[-1] = c
				break
print(res)
print(''.join(garland))


n = int(input())
ip = list(input())
k = n // 3
s = [''] * 6
s[0] = 'RGB' * k + 'RGB'[0:n % 3]
s[1] = 'RBG' * k + 'RBG'[0:n % 3]
s[2] = 'GRB' * k + 'GRB'[0:n % 3]
s[3] = 'GBR' * k + 'GBR'[0:n % 3]
s[4] = 'BRG' * k + 'BRG'[0:n % 3]
s[5] = 'BGR' * k + 'BGR'[0:n % 3]
m = 9999999999
ans = ''
for i in range(6):
	c = 0
	for j in range(n):
		if s[i][j] != ip[j]:
			c += 1
	if c < m:
		m = c
		ans = s[i]
print(m)
print(ans)


n = int(input())
s = list(input())
cnt = 0
for i in range(1, len(s)):
	if s[i] == s[i - 1]:
		if i == len(s) - 1:
			if s[i] == 'B':
				s[i] = 'G'
			elif s[i] == 'G':
				s[i] = 'B'
			else:
				s[i] = 'G'
			cnt += 1
			break
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'R'
		elif s[i] == 'B' and s[i + 1] == 'R':
			s[i] = 'G'
		elif s[i] == 'R' and s[i + 1] == 'G':
			s[i] = 'B'
		elif s[i] == 'R' and s[i + 1] == 'B':
			s[i] = 'G'
		elif s[i] == 'G' and s[i + 1] == 'B':
			s[i] = 'R'
		elif s[i] == 'G' and s[i + 1] == 'R':
			s[i] = 'B'
		elif s[i] == 'G' and s[i + 1] == 'G':
			s[i] = 'R'
		elif s[i] == 'R' and s[i + 1] == 'R':
			s[i] = 'B'
		elif s[i] == 'B' and s[i + 1] == 'B':
			s[i] = 'G'
		cnt += 1
print(cnt)
print(''.join(s))


n = int(input())
s = input()
arr = []
for i in range(n):
	arr.append(s[i])
c = 0
for i in range(n - 1):
	if arr[i] == arr[i + 1]:
		c += 1
		if i + 2 < n:
			if arr[i] == 'R':
				if arr[i + 2] == 'G':
					arr[i + 1] = 'B'
				else:
					arr[i + 1] = 'G'
			elif arr[i] == 'B':
				if arr[i + 2] == 'G':
					arr[i + 1] = 'R'
				else:
					arr[i + 1] = 'G'
			elif arr[i + 2] == 'R':
				arr[i + 1] = 'B'
			else:
				arr[i + 1] = 'R'
		elif arr[i] == 'R':
			arr[i + 1] = 'G'
		elif arr[i] == 'G':
			arr[i + 1] = 'R'
		else:
			arr[i + 1] = 'R'
an = ''
for i in range(n):
	an += arr[i]
print(c)
print(an)


n = int(input())
s = [*input()] + [0]
m = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		m += 1
		s[i] = next((c for c in 'RGB' if s[i - 1] != c != s[i + 1]))
print(m, ''.join(s[:-1]))


n = int(input())
a = ['R', 'B', 'G']
s = input()
l = []
count = 0
for i in range(n):
	if l == []:
		l.append(s[i])
	elif i != n - 1:
		x = l.pop()
		l.append(x)
		if s[i] == x:
			count += 1
			if s[i + 1] == s[i]:
				if a[0] != s[i]:
					l.append(a[0])
				else:
					l.append(a[1])
			elif a[0] != s[i] and a[0] != s[i + 1]:
				l.append(a[0])
			elif a[1] != s[i] and a[1] != s[i + 1]:
				l.append(a[1])
			else:
				l.append(a[2])
		else:
			l.append(s[i])
	else:
		x = l.pop()
		l.append(x)
		if s[i] == x:
			count += 1
			if a[0] != s[i]:
				l.append(a[0])
			else:
				l.append(a[1])
		else:
			l.append(s[i])
print(count)
for i in l:
	print(i, end='')


n = int(input())
m = input()
s = []
s.append('A')
for i in range(0, n, 1):
	s.append(m[i])
s.append('A')
ch = 0
for i in range(1, n + 2, 1):
	if s[i] == s[i - 1]:
		ch += 1
		if s[i] == 'R':
			if s[i + 1] == 'G':
				s[i] = 'B'
			else:
				s[i] = 'G'
		elif s[i] == 'G':
			if s[i + 1] == 'R':
				s[i] = 'B'
			else:
				s[i] = 'R'
		elif s[i + 1] == 'R':
			s[i] = 'G'
		else:
			s[i] = 'R'
print(ch)
for i in range(1, n + 1, 1):
	print(s[i], end='')


n = int(input())
s1 = input()
(c1, c2, c3, c4, c5, c6) = (0, 0, 0, 0, 0, 0)
for i in range(n):
	if i % 3 == 0:
		if s1[i] != 'R':
			c1 += 1
			c2 += 1
		if s1[i] != 'B':
			c3 += 1
			c4 += 1
		if s1[i] != 'G':
			c5 += 1
			c6 += 1
	if i % 3 == 1:
		if s1[i] != 'R':
			c4 += 1
			c5 += 1
		if s1[i] != 'B':
			c2 += 1
			c6 += 1
		if s1[i] != 'G':
			c1 += 1
			c3 += 1
	if i % 3 == 2:
		if s1[i] != 'R':
			c3 += 1
			c6 += 1
		if s1[i] != 'B':
			c1 += 1
			c5 += 1
		if s1[i] != 'G':
			c2 += 1
			c4 += 1
b = min(c1, c2, c3, c4, c5, c6)
print(b)
s = ''
for i in range(n):
	if c1 == b and len(s) != i + 1:
		if i % 3 == 0:
			s += 'R'
		if i % 3 == 1:
			s += 'G'
		if i % 3 == 2:
			s += 'B'
	if c2 == b and len(s) != i + 1:
		if i % 3 == 0:
			s += 'R'
		if i % 3 == 1:
			s += 'B'
		if i % 3 == 2:
			s += 'G'
	if c3 == b and len(s) != i + 1:
		if i % 3 == 0:
			s += 'B'
		if i % 3 == 1:
			s += 'G'
		if i % 3 == 2:
			s += 'R'
	if c4 == b and len(s) != i + 1:
		if i % 3 == 0:
			s += 'B'
		if i % 3 == 1:
			s += 'R'
		if i % 3 == 2:
			s += 'G'
	if c5 == b and len(s) != i + 1:
		if i % 3 == 0:
			s += 'G'
		if i % 3 == 1:
			s += 'R'
		if i % 3 == 2:
			s += 'B'
	if c6 == b and len(s) != i + 1:
		if i % 3 == 0:
			s += 'G'
		if i % 3 == 1:
			s += 'B'
		if i % 3 == 2:
			s += 'R'
print(s)


n = int(input())
s = input()
f = []
y = len(s)
f.append(s[0])
k = 0
a = ['R', 'B', 'G']
for i in range(1, y):
	if f[i - 1] != s[i]:
		f.append(s[i])
		continue
	else:
		a.remove(f[i - 1])
		k = k + 1
		if i < n - 1 and a[0] == s[i + 1]:
			f.append(a[1])
		else:
			f.append(a[0])
		a.append(f[i - 1])
print(k)
print(''.join(f))


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)


am = int(input())
data = list(input())
am = len(data)
letters = ['R', 'G', 'B']
letters2 = ['B', 'G', 'R']
minWas = 9999999999999999
ind = 0
fl = False
for g in range(3):
	n = 0
	for i in range(am):
		if data[i] != letters[(g + i) % 3]:
			n += 1
	if n < minWas:
		minWas = n
		ind = g
for g in range(3):
	n = 0
	for i in range(am):
		if data[i] != letters2[(g + i) % 3]:
			n += 1
	if n < minWas:
		fl = True
		minWas = n
		ind = g
print(minWas)
if not fl:
	for i in range(am):
		print(letters[(i + ind) % 3], end='')
else:
	for i in range(am):
		print(letters2[(i + ind) % 3], end='')


s = int(input())
l = input()
a = list(l)
c = 0
for i in range(1, s):
	if a[i] == a[i - 1]:
		c += 1
		if i == s - 1:
			if a[i - 1] != 'R':
				a[i] = 'R'
			elif a[i - 1] != 'G':
				a[i] = 'G'
			else:
				a[i] = 'B'
		elif a[i - 1] != 'R' and a[i + 1] != 'R':
			a[i] = 'R'
		elif a[i - 1] != 'G' and a[i + 1] != 'G':
			a[i] = 'G'
		else:
			a[i] = 'B'
print(c)
print(*a, sep='')


n = int(input())
pt = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
k = [0] * 6
i = 0
for c in input():
	for j in range(6):
		if c != pt[j][i % 3]:
			k[j] += 1
	i += 1
m = 2 * 10 ** 5
for i in range(6):
	if m > k[i]:
		(m, z) = (k[i], i)
print(m)
ans = ''
for i in range(n):
	ans += pt[z][i % 3]
print(ans)


n = int(input())
s = input()
rgb = 'RGB' * (n // 3) + 'RGB'[0:n % 3]
rbg = 'RBG' * (n // 3) + 'RBG'[0:n % 3]
grb = 'GRB' * (n // 3) + 'GRB'[0:n % 3]
gbr = 'GBR' * (n // 3) + 'GBR'[0:n % 3]
brg = 'BRG' * (n // 3) + 'BRG'[0:n % 3]
bgr = 'BGR' * (n // 3) + 'BGR'[0:n % 3]
ls = []
ls.append(rgb)
ls.append(rbg)
ls.append(grb)
ls.append(gbr)
ls.append(brg)
ls.append(bgr)
mini = 9999999999
ans = s
for i in range(0, 6):
	cnt = 0
	for j in range(0, n):
		if s[j] != ls[i][j]:
			cnt += 1
	if mini > cnt:
		mini = cnt
		ans = ls[i]
print(mini)
print(ans)


n = int(input())
s = input()
c1 = 'RGB'
c2 = 'RBG'
c3 = 'GRB'
c4 = 'GBR'
c5 = 'BRG'
c6 = 'BGR'
c = [0] * 6
for i in range(len(s)):
	if s[i] != c1[i % 3]:
		c[0] += 1
	if s[i] != c2[i % 3]:
		c[1] += 1
	if s[i] != c3[i % 3]:
		c[2] += 1
	if s[i] != c4[i % 3]:
		c[3] += 1
	if s[i] != c5[i % 3]:
		c[4] += 1
	if s[i] != c6[i % 3]:
		c[5] += 1
x = min(c)
chaice = -1
for i in range(6):
	if c[i] == x:
		chaice = i
		break
st = ''
if chaice == 0:
	st += c1
if chaice == 1:
	st += c2
if chaice == 2:
	st += c3
if chaice == 3:
	st += c4
if chaice == 4:
	st += c5
if chaice == 5:
	st += c6
print(x)
for i in range(n):
	print(st[i % 3], end='')
print()


n = int(input())
a = list(input())
count = 0
i = 0
while i < n - 1:
	if a[i] == a[i + 1]:
		count += 1
		i += 2
	else:
		i += 1
i = 0
while i < n - 1:
	if a[i] == a[i + 1]:
		if a[i] == 'B':
			if i + 2 < n:
				if a[i + 2] == 'G':
					a[i + 1] = 'R'
				else:
					a[i + 1] = 'G'
			else:
				a[i + 1] = 'G'
		elif a[i] == 'G':
			if i + 2 < n:
				if a[i + 2] == 'B':
					a[i + 1] = 'R'
				else:
					a[i + 1] = 'B'
			else:
				a[i + 1] = 'R'
		elif a[i] == 'R':
			if i + 2 < n:
				if a[i + 2] == 'G':
					a[i + 1] = 'B'
				else:
					a[i + 1] = 'G'
			else:
				a[i + 1] = 'G'
		i += 2
	else:
		i += 1
print(count)
print(''.join(a))


t = int(input())
st = input()
s1 = 'RGB' * 66669
s2 = 'RBG' * 66669
st3 = ''
minn = 0
count = 0
for y in range(3):
	count = 0
	s = s1[y:]
	for x in range(t):
		if s[x] == st[x]:
			count += 1
	if count > minn:
		minn = count
		st3 = s1[y:]
for y in range(3):
	count = 0
	s = s2[y:]
	for x in range(t):
		if s[x] == st[x]:
			count += 1
	if count > minn:
		minn = count
		st3 = s2[y:]
gg = t
for x in range(t):
	if st[x] == st3[x]:
		gg -= 1
print(gg)
print(st3[:t])


n = int(input())
s = input()
new_s = [s[0]]
c = 0
for i in range(1, n):
	if new_s[-1] == s[i]:
		a = set('RGB')
		a.remove(s[i - 1])
		if i < n - 1:
			if s[i + 1] in a:
				a.remove(s[i + 1])
		new_s.append(next(iter(a)))
		c += 1
	else:
		new_s.append(s[i])
print(c)
print(''.join(new_s))


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
s = si()
mn = 10000000
ind = ''
a = ['RBG', 'RGB', 'GRB', 'GBR', 'BRG', 'BGR']
for i in a:
	x = i * n
	c = 0
	for (j, k) in zip(s, x[:n]):
		if j != k:
			c += 1
	if c < mn:
		mn = c
		ind = i
print(mn)
print((ind * n)[:n])


import sys
inf = float('inf')
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def main():
	n = int(input())
	s = list(input().strip())
	if n == 1:
		print(0)
		print(*s, sep='')
		return
	if n == 2:
		if s[0] != s[1]:
			print(0)
			print(*s, sep='')
			return
		if s[0] == s[1]:
			print(1)
			if s[0] == 'R':
				print('RG')
				return
			elif s[0] == 'G':
				print('GB')
				return
			elif s[0] == 'B':
				print('BR')
				return
	(mn, count) = (inf, 0)
	for i in range(n - 2):
		if s[i] == s[i + 1]:
			count += 1
			if s[i + 1] == s[i + 2]:
				if s[i] == 'R':
					s[i + 1] = 'G'
				elif s[i] == 'G':
					s[i + 1] = 'B'
				elif s[i] == 'B':
					s[i + 1] = 'G'
			elif (s[i] == 'R' or s[i] == 'G') and (s[i + 2] == 'R' or s[i + 2] == 'G'):
				s[i + 1] = 'B'
			elif (s[i] == 'R' or s[i] == 'B') and (s[i + 2] == 'R' or s[i + 2] == 'B'):
				s[i + 1] = 'G'
			elif (s[i] == 'B' or s[i] == 'G') and (s[i + 2] == 'B' or s[i + 2] == 'G'):
				s[i + 1] = 'R'
	if s[-1] == s[-2]:
		count += 1
		if s[-2] == 'R':
			s[-1] = 'G'
		elif s[-2] == 'G':
			s[-1] = 'B'
		elif s[-2] == 'B':
			s[-1] = 'R'
	print(count)
	print(*s, sep='')
main()


n = int(input())
s = [*input()]
ans = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		ans += 1
		s[i] = (set('RGB') - set(s[i - 1:i + 2])).pop()
print(ans)
print(''.join(s))


n = int(input())
a = input()
z = [a[0]]
s = ['R', 'B', 'G']
count = 0
for i in range(1, n):
	if a[i] != z[-1]:
		z.append(a[i])
	else:
		for j in s:
			if i + 1 < n:
				if j != a[i + 1] and j != a[i]:
					z.append(j)
					count += 1
					break
			elif j != a[i]:
				z.append(j)
				count += 1
				break
print(count)
print(''.join(z))


n = int(input())
s = list(input())
c = s.copy()
t = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
ans = []
____ = 0
for ___ in range(6):
	cur = 0
	cnt = 0
	s = c.copy()
	for _ in range(n):
		if s[_] != t[___][cur % 3]:
			cnt += 1
			s[_] = t[___][cur % 3]
		cur += 1
	ans.append([cnt, s])
	if ans[____][0] > ans[___][0]:
		____ = ___
print(ans[____][0])
for _______ in ans[____][1]:
	print(_______, end='')


n = int(input())
s1 = input()
a = list(s1)
c = 0
for i in range(1, n):
	if a[i] == a[i - 1]:
		c += 1
		if a[i - 1] == 'R':
			if i + 1 != n:
				if a[i + 1] == 'G':
					a[i] = 'B'
				else:
					a[i] = 'G'
			else:
				a[i] = 'G'
		if a[i - 1] == 'G':
			if i + 1 != n:
				if a[i + 1] == 'B':
					a[i] = 'R'
				else:
					a[i] = 'B'
			else:
				a[i] = 'B'
		if a[i - 1] == 'B':
			if i + 1 != n:
				if a[i + 1] == 'G':
					a[i] = 'R'
				else:
					a[i] = 'G'
			else:
				a[i] = 'G'
print(c)
for i in a:
	print(i, end='')


n = int(input())
s = list(input())
ans = ''
ans += s[0]
count = 0
for i in range(1, n):
	if s[i] == s[i - 1] == 'R':
		if i + 1 < n:
			if s[i + 1] == 'G':
				s[i] = 'B'
			else:
				s[i] = 'G'
		else:
			s[i] = 'B'
		count += 1
	elif s[i] == s[i - 1] == 'B':
		if i + 1 < n:
			if s[i + 1] == 'R':
				s[i] = 'G'
			else:
				s[i] = 'R'
		else:
			s[i] = 'R'
		count += 1
	elif s[i] == s[i - 1] == 'G':
		if i + 1 < n:
			if s[i + 1] == 'B':
				s[i] = 'R'
			else:
				s[i] = 'B'
		else:
			s[i] = 'B'
		count += 1
print(count)
for i in range(len(s)):
	print(s[i], end='')


n = int(input())
org_str = input()
rbg_str = 'RBG' * (n // 3)
if n % 3 == 1:
	rbg_str += 'R'
elif n % 3 == 2:
	rbg_str += 'RB'
rgb_str = 'RGB' * (n // 3)
if n % 3 == 1:
	rgb_str += 'R'
elif n % 3 == 2:
	rgb_str += 'RG'
brg_str = 'BRG' * (n // 3)
if n % 3 == 1:
	brg_str += 'B'
elif n % 3 == 2:
	brg_str += 'BR'
bgr_str = 'BGR' * (n // 3)
if n % 3 == 1:
	bgr_str += 'B'
elif n % 3 == 2:
	bgr_str += 'BG'
grb_str = 'GRB' * (n // 3)
if n % 3 == 1:
	grb_str += 'G'
elif n % 3 == 2:
	grb_str += 'GR'
gbr_str = 'GBR' * (n // 3)
if n % 3 == 1:
	gbr_str += 'G'
elif n % 3 == 2:
	gbr_str += 'GB'
diff = []
diff_str = [rbg_str, rgb_str, brg_str, bgr_str, grb_str, gbr_str]
for i in range(6):
	x = 0
	for j in range(n):
		if diff_str[i][j] != org_str[j]:
			x += 1
	diff.append(x)
print(min(diff))
print(diff_str[diff.index(min(diff))])


def main():
	_n = int(input())
	garland = input().strip()
	if len(garland) == 1:
		print(0)
		print(garland)
		return
	elif len(garland) == 2:
		if garland[0] != garland[1]:
			print(0)
			print(garland)
		else:
			print(1)
			print(garland[0] + ('B' if garland[1] != 'B' else 'R'))
		return
	lists = [[], [], []]
	for offset in range(3):
		lists[offset] = [c for (i, c) in enumerate(garland) if i % 3 == offset]
	orders = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
	min_changed_sum = None
	min_changed_sum_order = None
	for order in orders:
		changed_sum = 0
		for offset in range(3):
			temp = len(lists[offset]) - lists[offset].count(order[offset])
			changed_sum += temp
		if min_changed_sum is None or min_changed_sum > changed_sum:
			min_changed_sum = changed_sum
			min_changed_sum_order = order
	print(min_changed_sum)
	print(min_changed_sum_order * (len(garland) // 3) + min_changed_sum_order[0:len(garland) % 3])
main()


def solve():
	n = int(input())
	s = input()
	t = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
	b = [0] * 6
	for i in range(n):
		for j in range(6):
			if s[i] != t[j][i % 3]:
				b[j] += 1
	mn = min(b)
	x = b.index(mn)
	print(mn)
	print(t[x] * (n // 3) + t[x][:n % 3])
t = 1
while t:
	solve()
	t -= 1


n = int(input())
s = input()
c = []
i = 0
while i < n:
	t = s[i]
	C = 0
	while t == s[i]:
		C += 1
		i += 1
		if i == n:
			break
	c.append(C)
q = 0
ans = ''
i = 0
j = 0
while j < len(c):
	if c[j] == 1:
		ans = ans + s[i]
		i = i + c[j]
		j = j + 1
	else:
		if c[j] % 2 == 1:
			if len(ans) > 0:
				char = ans[-1]
			elif s[i] == 'R':
				char = 'G'
			else:
				char = 'R'
			char2 = s[i]
			for x in range(c[j]):
				if x % 2 == 1:
					ans = ans + char
					q = q + 1
				else:
					ans = ans + char2
		elif c[j] > 2:
			if len(ans) > 0:
				char2 = s[i]
				if ans[-1] == 'R':
					if s[i] == 'G':
						char = 'B'
					else:
						char = 'G'
				elif ans[-1] == 'B':
					if s[i] == 'G':
						char = 'R'
					else:
						char = 'G'
				elif s[i] == 'B':
					char = 'R'
				else:
					char = 'B'
			else:
				char2 = s[i]
				if s[i] == 'R':
					char = 'B'
				else:
					char = 'R'
			for x in range(c[j]):
				if x % 2 == 0:
					ans = ans + char
					q = q + 1
				else:
					ans = ans + char2
		else:
			if len(ans) > 0:
				if ans[-1] == 'R':
					if s[i] == 'B':
						ans = ans + 'G' + 'B'
					else:
						ans = ans + 'B' + 'G'
				elif ans[-1] == 'B':
					if s[i] == 'R':
						ans = ans + 'G' + 'R'
					else:
						ans = ans + 'R' + 'G'
				elif ans[-1] == 'G':
					if s[i] == 'R':
						ans = ans + 'B' + 'R'
					else:
						ans = ans + 'R' + 'B'
			elif s[i] == 'B':
				ans = ans + 'R' + 'B'
			elif s[i] == 'R':
				ans = ans + 'G' + 'R'
			else:
				ans = ans + 'R' + 'G'
			q = q + 1
		i = i + c[j]
		j = j + 1
print(q)
print(ans)


import sys
from itertools import permutations

def perebor(s, stroka):
	count = 0
	s2 = list(s)
	for l in range(min(len(s), len(stroka))):
		if s2[l] != stroka[l]:
			count += 1
			s2[l] = stroka[l]
	for ind in range(len(stroka), len(s)):
		if s2[ind] != s2[ind - 3]:
			s2[ind] = s2[ind - 3]
			count += 1
	return (s2, count)
n = int(input())
s = list(input())
count = 0
p = permutations('RGB')
count_best = 9999999
s_best = 99999999
for l in p:
	(s1, count1) = perebor(s, l)
	if count1 < count_best:
		s_best = s1
		count_best = count1
print(count_best)
print(''.join(s_best))


n = int(input())
s = input()
comb = ['BGR', 'BRG', 'GBR', 'GRB', 'RBG', 'RGB']
ans = n
for c in comb:
	ex = c * (n // 3) + c[:n % 3]
	cnt = 0
	for i in range(n):
		if s[i] != ex[i]:
			cnt += 1
	if cnt <= ans:
		ans = cnt
		res = ex
print(ans)
print(res)


import sys
input = sys.stdin.readline
from math import ceil, floor, factorial

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
n = int(input())
s = input().strip()
dp = [[INF for _ in range(3)] for __ in range(n)]
for i in range(n):
	x = ['R', 'G', 'B'].index(s[i])
	if i == 0:
		for j in range(3):
			if j == x:
				dp[i][j] = 0
			else:
				dp[i][j] = 1
	elif x == 0:
		dp[i][0] = min(dp[i - 1][1], dp[i - 1][2])
		dp[i][1] = 1 + min(dp[i - 1][0], dp[i - 1][2])
		dp[i][2] = 1 + min(dp[i - 1][0], dp[i - 1][1])
	elif x == 1:
		dp[i][1] = min(dp[i - 1][0], dp[i - 1][2])
		dp[i][0] = 1 + min(dp[i - 1][1], dp[i - 1][2])
		dp[i][2] = 1 + min(dp[i - 1][0], dp[i - 1][1])
	else:
		dp[i][2] = min(dp[i - 1][0], dp[i - 1][1])
		dp[i][1] = 1 + min(dp[i - 1][0], dp[i - 1][2])
		dp[i][0] = 1 + min(dp[i - 1][1], dp[i - 1][2])
answer = min(dp[n - 1])
s = 'RGB'
ans = []
prev = None
for i in range(n - 1, -1, -1):
	if prev == None:
		for j in range(3):
			if dp[i][j] == answer:
				prev = j
				ans.append(s[j])
				break
	else:
		mn = INF
		ind = None
		for j in range(3):
			if j == prev:
				continue
			if dp[i][j] < mn:
				mn = dp[i][j]
				ind = j
		prev = ind
		ans.append(s[ind])
ans = ''.join(ans[::-1])
print(answer)
print(ans)


num_of_lamps = int(input())
colours_of_lamps = input()

def rgb_max_pos(r, g, b):
	x = list(r.values())
	y = list(g.values())
	z = list(b.values())
	a0b1c2 = [x[0], y[1], z[2]]
	a0c1b2 = [x[0], z[1], y[2]]
	b0a1c2 = [y[0], x[1], z[2]]
	b0c1a2 = [y[0], z[1], x[2]]
	c0a1b2 = [z[0], x[1], y[2]]
	c0b1a2 = [z[0], y[1], x[2]]
	abc_list = [sum(a0b1c2), sum(a0c1b2), sum(b0a1c2), sum(b0c1a2), sum(c0a1b2), sum(c0b1a2)]
	if max(abc_list) == sum(a0b1c2):
		return 'RGB'
	elif max(abc_list) == sum(a0c1b2):
		return 'RBG'
	elif max(abc_list) == sum(b0a1c2):
		return 'GRB'
	elif max(abc_list) == sum(b0c1a2):
		return 'GBR'
	elif max(abc_list) == sum(c0a1b2):
		return 'BRG'
	elif max(abc_list) == sum(c0b1a2):
		return 'BGR'
r_pos = {}
b_pos = {}
g_pos = {}
rgb_idx1 = 0
position_counter1 = 0
position_counter_R = 0
position_counter_G = 0
position_counter_B = 0
for _ in range(len('RGB')):
	for i in range(rgb_idx1, num_of_lamps, 3):
		if 'R' == colours_of_lamps[i]:
			position_counter_R += 1
		elif 'G' == colours_of_lamps[i]:
			position_counter_G += 1
		elif 'B' == colours_of_lamps[i]:
			position_counter_B += 1
	r_pos[rgb_idx1] = position_counter_R
	g_pos[rgb_idx1] = position_counter_G
	b_pos[rgb_idx1] = position_counter_B
	rgb_idx1 += 1
	position_counter1 = 0
	position_counter_R = 0
	position_counter_G = 0
	position_counter_B = 0
combo1 = rgb_max_pos(r_pos, g_pos, b_pos)
nice_garland1 = combo1 * (num_of_lamps // 3) + combo1[:num_of_lamps % 3]
changed_lamps_amount1 = sum(list(map(lambda x, y: 1 if x != y else 0, colours_of_lamps, nice_garland1)))
print(changed_lamps_amount1)
print(nice_garland1)


n = int(input())
s = input()
min = 200005
t1 = ''
for t in ('RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR'):
	r = sum((x != y for (x, y) in zip(s, t * (n // 3 + 1))))
	if r < min:
		min = r
		t1 = t
print(min)
print((t1 * n)[:n])


n = int(input())
arr = input()
arr_ = [arr[0::3], arr[1::3], arr[2::3]]
letter = [{'R': 0, 'G': 0, 'B': 0} for i in range(3)]
for i in range(3):
	for x in arr_[i]:
		letter[i][x] = letter[i][x] + 1
(ans, ans_le) = (0, [])
for i in ['R', 'G', 'B']:
	for j in ['R', 'G', 'B']:
		if i == j:
			continue
		for k in ['R', 'G', 'B']:
			if i == k or j == k:
				continue
			al = letter[0][i] + letter[1][j] + letter[2][k]
			if al > ans:
				ans = al
				ans_le = [i, j, k]
print(n - ans)
print(''.join((ans_le[i % 3] for i in range(n))))


def other(a, b):
	if a == 'R' and b == 'B':
		return 'G'
	if a == 'R' and b == 'G':
		return 'B'
	if a == 'R' and b == 'R':
		return 'G'
	if a == 'B' and b == 'B':
		return 'G'
	if a == 'B' and b == 'G':
		return 'R'
	if a == 'B' and b == 'R':
		return 'G'
	if a == 'G' and b == 'G':
		return 'R'
	if a == 'G' and b == 'B':
		return 'R'
	if a == 'G' and b == 'R':
		return 'B'
n = int(input())
s = input()
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if s[0] == s[1]:
		print(1)
		print(s[0] + ('G' if s[0] != 'G' else 'R'))
	else:
		print(0)
		print(s)
else:
	s = [i for i in s]
	o = []
	c = 0
	for i in range(n - 2):
		if s[i] == s[i + 1]:
			s[i + 1] = other(s[i], s[i + 2])
			c += 1
	if s[n - 2] == s[n - 1]:
		s[n - 1] = 'G' if s[n - 2] != 'G' else 'R'
		c += 1
	print(c, ''.join(s), sep='\n')


import itertools
n = int(input())
s = input()

def diff(a, b):
	return sum(map(lambda x: x[0] != x[1], zip(a, b)))
wyn = (n + 1, '')
for per in itertools.permutations('BGR'):
	t = ''.join((per * ((n + 2) // 3))[:n])
	wyn = min(wyn, (diff(s, t), t))
print(wyn[0], wyn[1], sep='\n')


n = int(input())

def fun(a):
	b = a
	a = a * (n // 3)
	a += b[:n % 3]
	return a
arr = []
arr.append(fun('RGB'))
arr.append(fun('RBG'))
arr.append(fun('GRB'))
arr.append(fun('GBR'))
arr.append(fun('BRG'))
arr.append(fun('BGR'))
s = input()
ans = 1000000000
ind = -1
for i in range(6):
	temp = 0
	for j in range(n):
		if arr[i][j] != s[j]:
			temp += 1
	if temp <= ans:
		ans = temp
		ind = i
print(ans)
print(arr[ind])


n = int(input())
s = list(input())
rgb = ['R', 'B', 'G']
x = 0
if n == 1:
	print(0)
	print(s[0])
	exit(0)
for i in range(len(s) - 2):
	if s[i] == s[i + 1] and s[i] != s[i + 2]:
		rgb.remove(s[i])
		rgb.remove(s[i + 2])
		s[i + 1] = rgb[0]
		x += 1
	elif s[i] == s[i + 1]:
		rgb.remove(s[i])
		s[i + 1] = rgb[0]
		x += 1
	rgb = ['R', 'B', 'G']
if s[len(s) - 2] == s[len(s) - 1]:
	rgb.remove(s[len(s) - 2])
	s[len(s) - 1] = rgb[0]
	x += 1
print(x)
print(''.join(s))


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())
l = list(input())
i = 1
c = 0
while i < n - 1:
	if l[i] == l[i - 1]:
		c += 1
		if l[i] == 'R':
			if l[i + 1] == 'G':
				l[i] = 'B'
			else:
				l[i] = 'G'
		elif l[i] == 'G':
			if l[i + 1] == 'R':
				l[i] = 'B'
			else:
				l[i] = 'R'
		elif l[i] == 'B':
			if l[i + 1] == 'R':
				l[i] = 'G'
			else:
				l[i] = 'R'
	i += 1
if n != 1:
	if l[n - 1] == l[n - 2]:
		c += 1
		if l[n - 1] == 'R':
			l[n - 1] = 'G'
		else:
			l[n - 1] = 'R'
print(c)
print(''.join(l))


n = int(input())
s = '!' + input().strip()
dp = [[10 ** 6] * (n + 1) for i in range(3)]
pr = [[None] * (n + 1) for i in range(3)]
dp[0][0] = dp[1][0] = dp[2][0] = 0
for i in range(1, n + 1):
	for c in range(3):
		op1 = dp[(c + 1) % 3][i - 1]
		op2 = dp[(c + 2) % 3][i - 1]
		pr[c][i] = (c + 1) % 3 if op1 < op2 else (c + 2) % 3
		dp[c][i] = min(op1, op2) + ('RGB'.index(s[i]) != c)
ans = []
end = [dp[0][n], dp[1][n], dp[2][n]]
c = end.index(min(end))
for i in range(n, 0, -1):
	ans.append(c)
	c = pr[c][i]
print(min(end))
print(''.join(('RGB'[c] for c in ans[::-1])))


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

def fn(val, i):
	t = 'RGB'
	a = [0] * 3
	if val != s[i - 1]:
		return val
	else:
		a[t.index(val)] += 1
		a[t.index(s[i - 1])] += 1
		a[t.index(s[i + 1])] += 1
		for i in range(3):
			if a[i] == 0:
				return t[i]
ans = 0
for i in range(1, n - 1):
	x = fn(s[i], i)
	if x != s[i]:
		ans += 1
	s[i] = x
if n > 1:
	if s[-1] == s[n - 2]:
		ans += 1
		t = 'RGB'
		a = [0] * 3
		a[t.index(s[n - 1])] += 1
		for i in range(3):
			if a[i] == 0:
				s[-1] = t[i]
				break
print(ans)
print(''.join(s))


colors = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
(n, s, a) = (int(input()), input(), [])
for i in colors:
	d = 0
	t = i * -(-n // 3)
	for j in range(n):
		if s[j] != t[j]:
			d += 1
	a.append(d)
print(min(a))
answ = colors[a.index(min(a))] * -(-n // 3)
answ = ''.join([answ[i] for i in range(n)])
print(answ)


import sys
input = sys.stdin.readline
n = int(input())
S = input().strip()
LIST = ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']
ANS = [0] * 6
for i in range(n):
	for j in range(6):
		if S[i] != LIST[j][i % 3]:
			ANS[j] += 1
print(min(ANS))
x = ANS.index(min(ANS))
ANSLIST = []
for i in range(n):
	ANSLIST.append(LIST[x][i % 3])
print(''.join(ANSLIST))


n = int(input())
letter = input()
pose = [{'R': 0, 'G': 0, 'B': 0}, {'R': 0, 'G': 0, 'B': 0}, {'R': 0, 'G': 0, 'B': 0}]
variant = {'RGB': 0, 'RBG': 0, 'GBR': 0, 'GRB': 0, 'BGR': 0, 'BRG': 0}
for i in range(0, 3):
	for j in range(i, len(letter), 3):
		pose[i][letter[j]] += 1

def price_calc(variant_key):
	global pose
	price = 0
	for i in range(0, 3):
		letter = variant_key[i]
		for pose_key in pose[i]:
			if not letter == pose_key:
				price += pose[i][pose_key]
	variant[variant_key] = price
	return price
min_price = price_calc('RGB')
min_key = 'RGB'
for variant_key in variant:
	price = price_calc(variant_key)
	if price < min_price:
		min_key = variant_key
		min_price = price
times = n // 3
rep = n % 3
result = min_key * times + min_key[0:rep]
print(min_price)
print(result)


n = int(input())
s = list(input())
a = ['GBR', 'GRB', 'RGB', 'RBG', 'BRG', 'BGR']
r = [0, 0, 0]
g = [0, 0, 0]
b = [0, 0, 0]
for i in range(n):
	if i % 3 == 0:
		if s[i] == 'R':
			r[0] += 1
		elif s[i] == 'G':
			g[0] += 1
		else:
			b[0] += 1
	elif i % 3 == 1:
		if s[i] == 'R':
			r[1] += 1
		elif s[i] == 'G':
			g[1] += 1
		else:
			b[1] += 1
	elif s[i] == 'R':
		r[2] += 1
	elif s[i] == 'G':
		g[2] += 1
	else:
		b[2] += 1
max = 10 ** 9
for i in range(6):
	count = 0
	if a[i][0] == 'G':
		count += r[0] + b[0]
	if a[i][0] == 'B':
		count += r[0] + g[0]
	if a[i][0] == 'R':
		count += g[0] + b[0]
	if a[i][1] == 'G':
		count += r[1] + b[1]
	if a[i][1] == 'B':
		count += r[1] + g[1]
	if a[i][1] == 'R':
		count += g[1] + b[1]
	if a[i][2] == 'G':
		count += r[2] + b[2]
	if a[i][2] == 'B':
		count += r[2] + g[2]
	if a[i][2] == 'R':
		count += g[2] + b[2]
	if count < max:
		max = count
		string = a[i]
re = []
for i in range(n):
	if i % 3 == 0:
		re.append(string[0])
	elif i % 3 == 1:
		re.append(string[1])
	else:
		re.append(string[2])
print(max)
for i in range(n):
	print(re[i], end='')


n = int(input())
s = input()
t = ''
t += s[0]
cnt = 0
for i in range(1, len(s)):
	if t[i - 1] == s[i]:
		c = [x for x in 'RGB' if x != t[i - 1] and x not in s[i + 1:i + 2]][0]
		t += c
		cnt += 1
	else:
		t += s[i]
print(cnt)
print(t)


n = int(input())
w = list(input())
count = 0
for i in range(1, len(w)):
	if w[i] != w[i - 1]:
		continue
	elif i != len(w) - 1:
		next = ['R', 'G', 'B']
		next.remove(w[i - 1])
		if w[i + 1] in next:
			next.remove(w[i + 1])
		w[i] = next[0]
		count += 1
	else:
		next = ['R', 'G', 'B']
		next.remove(w[i - 1])
		w[i] = next[0]
		count += 1
print(count)
print(''.join(w))


n = int(input())
l = ['R', 'B', 'G']
lamp = list(input())
if n == 1:
	print(0)
	print(lamp[0])
elif n == 2:
	if lamp[0] == lamp[1]:
		print(1)
		index = (l.index(lamp[0]) + 1) % 3
		print(lamp[0] + l[index])
else:
	ans = 4294967295
	fir = [['R', 'B', 'G'], ['R', 'G', 'B'], ['B', 'R', 'G'], ['B', 'G', 'R'], ['G', 'R', 'B'], ['G', 'B', 'R']]
	for each in fir:
		temp = 0
		for i in range(n):
			if not each[i % 3] == lamp[i]:
				temp += 1
		if temp < ans:
			col = each
			ans = temp
	print(ans)
	for i in range(n):
		print(col[i % 3], end='')
	print('')


n = int(input())
s = input()
c = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
anss = []
for b in range(len(c)):
	t = 0
	x = c[b] * (len(s) // 3) + c[b][:len(s) % 3]
	for i in range(len(s)):
		if x[i] != s[i]:
			t += 1
	anss.append(t)
minn = min(anss)
first_part = c[anss.index(minn)] * (len(s) // 3)
second_part = c[anss.index(minn)][:len(s) % 3]
print(minn, first_part + second_part, sep='\n')


def read_nums():
	return [int(x) for x in input().split()]

def main():
	(n,) = read_nums()
	s = input()
	count = 0
	res = [s[0]]
	for i in range(1, len(s)):
		if s[i] != res[i - 1]:
			res.append(s[i])
		else:
			count += 1
			if i + 1 < len(s):
				res.append([x for x in 'RGB' if x != s[i - 1] and x != s[i + 1]][0])
			else:
				res.append([x for x in 'RGB' if x != s[i - 1]][0])
	print(count)
	print(''.join(res))
main()


def find(pat, s):
	x = 0
	if pat[0] != s[0]:
		x += 1
	if pat[1] != s[1]:
		x += 1
	if pat[2] != s[2]:
		x += 1
	return x
n = int(input())
st = input()
dic = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
sum = 200000
ans = ''
for rgb in dic:
	ss = 0
	for i in range(0, 3 * (n // 3), 3):
		ss += find(rgb, st[i:i + 3])
	for i in range(n - n % 3, n):
		if st[i] != rgb[i % 3]:
			ss += 1
	if ss < sum:
		ans = rgb
		sum = ss
print(sum)
print(ans * (n // 3) + ans[:n % 3])


n = int(input())
s = list('.' + input() + '.')
a = 0
for i in range(1, n + 1):
	if s[i] == s[i - 1]:
		a += 1
		for ch in 'RGB':
			if ch != s[i - 1] and ch != s[i + 1]:
				s[i] = ch
				break
print(a)
print(''.join(s[1:-1]))


from itertools import permutations
n = int(input())
S = list(input())
patterns = list(permutations('RGB'))
scores = []
for pattern in patterns:
	full_string = pattern * (n // 3) + pattern[:n % 3]
	score = 0
	for i in range(n):
		if S[i] != full_string[i]:
			score += 1
	scores.append(score)
print(min(scores))
best_pattern = patterns[scores.index(min(scores))]
res = best_pattern * (n // 3) + best_pattern[:n % 3]
print(''.join(res))


n = int(input())
a = list(input())

def chk(x, y, z):
	k = 0
	b = [0] * n
	for i in range(0, n, 3):
		if a[i] != x:
			k += 1
		b[i] = x
	for i in range(1, n, 3):
		if a[i] != y:
			k += 1
		b[i] = y
	for i in range(2, n, 3):
		if a[i] != z:
			k += 1
		b[i] = z
	return (k, ''.join(b))
(c, d) = min(chk('R', 'G', 'B'), chk('R', 'B', 'G'), chk('G', 'R', 'B'), chk('G', 'B', 'R'), chk('B', 'G', 'R'), chk('B', 'R', 'G'))
print(c)
print(d)


def diffrence(a, n, auxi):
	total = 0
	i1 = 0
	c = 0
	while i1 < n and c == 0:
		if a[i1] != auxi[0]:
			total += 1
		if i1 + 1 < n:
			if a[i1 + 1] != auxi[1]:
				total += 1
		else:
			break
		if i1 + 2 < n:
			if a[i1 + 2] != auxi[2]:
				total += 1
		else:
			break
		i1 += 3
	return total
n = int(input())
a = input().rstrip()
totalp = [['R', 'G', 'B'], ['R', 'B', 'G'], ['G', 'R', 'B'], ['G', 'B', 'R'], ['B', 'R', 'G'], ['B', 'G', 'R']]
m = 10 ** 6
for i in range(len(totalp)):
	p1 = diffrence(a, n, totalp[i])
	if p1 < m:
		m = p1
		i3 = i
print(m)
i = 0
while i < n:
	print(totalp[i3][i % 3], end='')
	i += 1


n = int(input())
string = input()
patterns = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
count = 6 * [0]
for i in range(n):
	for j in range(6):
		if string[i] != patterns[j][i % 3]:
			count[j] += 1
ansNum = min(count)
pattern = patterns[count.index(ansNum)]
ansStr = pattern * (n // 3) + pattern[:n % 3]
print(ansNum)
print(ansStr)


n = int(input())
s = list(input())
ans = 0
key = s[:]
letters = ['R', 'G', 'B']
if len(s) == 1:
	print('0\n' + ''.join(s))
	exit()
if len(s) == 2:
	if s[0] == s[1]:
		print(1)
		if s[0] == 'G':
			s[0] = 'R'
		elif s[0] == 'B':
			s[0] = 'R'
		else:
			s[0] = 'B'
		print(''.join(s))
		exit()
	else:
		print(0)
		print(''.join(s))
s.append('0')
for i in range(1, len(s)):
	if s[i] == s[i - 1]:
		if s[i] == 'R':
			if s[i + 1] == 'B':
				s[i] = 'G'
				ans += 1
			elif s[i + 1] == 'G':
				s[i] = 'B'
				ans += 1
			else:
				s[i] = 'G'
				ans += 1
		elif s[i] == 'B':
			if s[i + 1] == 'B':
				s[i] = 'G'
			elif s[i + 1] == 'R':
				s[i] = 'G'
			else:
				s[i] = 'R'
			ans += 1
		elif s[i] == 'G':
			if s[i + 1] == 'G':
				s[i] = 'R'
			elif s[i + 1] == 'B':
				s[i] = 'R'
			else:
				s[i] = 'B'
			ans += 1
print(ans)
print(''.join(s[:-1]))


n = int(input())
s = input()
ans = 10000000
mark = 0
a = 'RGB'
c = 0
for i in range(n):
	c += s[i] != a[i % 3]
if ans > c:
	ans = c
	mark = 1
a = 'RBG'
c = 0
for i in range(n):
	c += s[i] != a[i % 3]
if ans > c:
	ans = c
	mark = 2
a = 'GRB'
c = 0
for i in range(n):
	c += s[i] != a[i % 3]
if ans > c:
	ans = c
	mark = 3
a = 'GBR'
c = 0
for i in range(n):
	c += s[i] != a[i % 3]
if ans > c:
	ans = c
	mark = 4
a = 'BGR'
c = 0
for i in range(n):
	c += s[i] != a[i % 3]
if ans > c:
	ans = c
	mark = 5
a = 'BRG'
c = 0
for i in range(n):
	c += s[i] != a[i % 3]
if ans > c:
	ans = c
	mark = 6
print(ans)
if mark == 1:
	a = 'RGB'
elif mark == 2:
	a = 'RBG'
elif mark == 3:
	a = 'GRB'
elif mark == 4:
	a = 'GBR'
elif mark == 5:
	a = 'BGR'
else:
	a = 'BRG'
c = 0
import sys
for i in range(n):
	print(a[i % 3], end='')


import sys
import math
input = sys.stdin.readline
n = int(input())
s = input()
R = [0, 0, 0]
G = [0, 0, 0]
B = [0, 0, 0]
for i in range(n):
	if s[i] == 'R':
		if i % 3 == 0:
			R[0] += 1
		elif i % 3 == 1:
			R[1] += 1
		else:
			R[2] += 1
	if s[i] == 'G':
		if i % 3 == 0:
			G[0] += 1
		elif i % 3 == 1:
			G[1] += 1
		else:
			G[2] += 1
	if s[i] == 'B':
		if i % 3 == 0:
			B[0] += 1
		elif i % 3 == 1:
			B[1] += 1
		else:
			B[2] += 1
Rneed = []
Gneed = []
Bneed = []
for i in range(3):
	Rneed.append(n // 3 - R[i])
	Gneed.append(n // 3 - G[i])
	Bneed.append(n // 3 - B[i])
	if n % 3 == 1 and i % 3 == 0:
		Rneed[-1] += 1
		Gneed[-1] += 1
		Bneed[-1] += 1
	elif n % 3 == 2 and i % 3 < 2:
		Rneed[-1] += 1
		Gneed[-1] += 1
		Bneed[-1] += 1
x1 = Rneed[0] + Gneed[1] + Bneed[2]
x2 = Rneed[0] + Gneed[2] + Bneed[1]
x3 = Rneed[1] + Gneed[0] + Bneed[2]
x4 = Rneed[1] + Gneed[2] + Bneed[0]
x5 = Rneed[2] + Gneed[0] + Bneed[1]
x6 = Rneed[2] + Gneed[1] + Bneed[0]
m = min(x1, x2, x3, x4, x5, x6)
trans = -1
fin = []
if x1 == m:
	trans = x1
	for i in range(n):
		if i % 3 == 0:
			fin.append('R')
		elif i % 3 == 1:
			fin.append('G')
		else:
			fin.append('B')
elif x2 == m:
	trans = x2
	for i in range(n):
		if i % 3 == 0:
			fin.append('R')
		elif i % 3 == 1:
			fin.append('B')
		else:
			fin.append('G')
elif x3 == m:
	trans = x3
	for i in range(n):
		if i % 3 == 0:
			fin.append('G')
		elif i % 3 == 1:
			fin.append('R')
		else:
			fin.append('B')
elif x4 == m:
	trans = x4
	for i in range(n):
		if i % 3 == 0:
			fin.append('B')
		elif i % 3 == 1:
			fin.append('R')
		else:
			fin.append('G')
elif x5 == m:
	trans = x5
	for i in range(n):
		if i % 3 == 0:
			fin.append('G')
		elif i % 3 == 1:
			fin.append('B')
		else:
			fin.append('R')
elif x6 == m:
	trans = x6
	for i in range(n):
		if i % 3 == 0:
			fin.append('B')
		elif i % 3 == 1:
			fin.append('G')
		else:
			fin.append('R')
print(trans)
print(''.join(fin))


n = int(input())
a = [0] * n
s = input()
k = 0
z = {'R': 0, 'G': 1, 'B': 2}
p = {0: 'R', 1: 'G', 2: 'B'}
r = {'RG': 2, 'RB': 1, 'GR': 2, 'GB': 0, 'BG': 0, 'BR': 1, 'RR': 1, 'GG': 2, 'BB': 1}
a[0] = z[s[0]]
for i in range(1, len(s) - 1):
	a[i] = z[s[i]]
	if a[i] == a[i - 1]:
		first = a[i]
		second = r[s[i - 1] + s[i + 1]]
		k += 1
		a[i] = second
if n >= 2:
	a[-1] = z[s[-1]]
	if a[-1] == a[-2]:
		k += 1
		a[-1] = (a[-1] + 1) % 3
print(k)
for i in range(n):
	print(p[a[i]], end='')


n = int(input())
s = input()
y = [-1]
for i in s:
	if i == 'R':
		y.append(1)
	elif i == 'B':
		y.append(2)
	else:
		y.append(3)
y.append(-1)
count = 0
i = 1
while i <= n:
	if y[i - 1] != y[i] and y[i] != y[i + 1]:
		i += 1
	else:
		j = i + 1
		m = 1
		while y[j] == y[j - 1] and j <= n + 2:
			j += 1
			m += 1
		if m % 2 == 0:
			k = i
			while k < i + m:
				if (y[k - 1] == 2 or y[k] == 2) and (y[k - 1] == 1 or y[k] == 1):
					y[k] = 3
				elif (y[k - 1] == 2 or y[k] == 2) and (y[k - 1] == 3 or y[k] == 3):
					y[k] = 1
				elif (y[k - 1] == 1 or y[k] == 1) and (y[k - 1] == 3 or y[k] == 3):
					y[k] = 2
				elif y[k + 1] == 1:
					y[k] = 2
				elif y[k + 1] == 2:
					y[k] = 3
				else:
					y[k] = 1
				k += 2
		else:
			k = i + 1
			while k < i + m:
				if y[k - 1] == 2:
					y[k] = 1
				elif y[k - 1] == 1:
					y[k] = 3
				else:
					y[k] = 2
				k += 2
		i = j
		count += m // 2
print(count)
for i in y:
	if i == 1:
		print('R', end='')
	elif i == 2:
		print('B', end='')
	elif i == 3:
		print('G', end='')


import copy

def kum(n, a):
	dd = []
	k = 0
	mm = ['R', 'G', 'B']
	for i in range(n):
		dd.append(a[i])
	tt = copy.deepcopy(mm)
	for i in range(n - 1):
		tt = copy.deepcopy(mm)
		if dd[i] == dd[i + 1]:
			tt.remove(dd[i])
			if i + 2 < n and dd[i] != dd[i + 2]:
				tt.remove(dd[i + 2])
			dd[i + 1] = tt[0]
			k += 1
	print(k)
	kk = ''.join(dd)
	print(kk)
n = int(input())
a = input()
ans = kum(n, a)


n = int(input())
st = input()
d = {'RGB': 0, 'RBG': 0, 'BRG': 0, 'BGR': 0, 'GRB': 0, 'GBR': 0}
for i in range(0, len(st), 3):
	nexttocheck = st[i:i + 3]
	for key in d:
		for j in range(0, 3):
			if j < len(nexttocheck) and key[j] != nexttocheck[j]:
				d[key] += 1
smallestsofar = float('inf')
smallestkeysofar = None
for key in d:
	if d[key] < smallestsofar:
		smallestsofar = d[key]
		smallestkeysofar = key
answer = ''
index = 0
for i in range(len(st)):
	answer += smallestkeysofar[index]
	index = (index + 1) % 3
print(smallestsofar)
print(answer)


n = int(input())
s = input()
a = ['G', 'R', 'B']
from itertools import permutations as per
ans = 10000000
str = ''
for k in list(per(a)):
	ans1 = 0
	for i in range(n):
		if s[i] != k[i % 3]:
			ans1 += 1
	if ans > ans1:
		ans = ans1
		str = k
print(ans)
for i in range(n):
	print(str[i % 3], end='')


from sys import stdin, stdout
n = int(stdin.readline())
s = list(stdin.readline().strip())
ans = 0
t = ''
for i in range(1, n):
	if s[i] == s[i - 1]:
		ans += 1
		if i + 1 < n and s[i + 1] == s[i]:
			if s[i] == 'R':
				s[i] = 'B'
			else:
				s[i] = 'R'
		elif i + 1 < n:
			if s[i] == 'R' and s[i + 1] == 'B':
				s[i] = 'G'
			elif s[i] == 'R' and s[i + 1] == 'G':
				s[i] = 'B'
			elif s[i] == 'B' and s[i + 1] == 'G':
				s[i] = 'R'
			elif s[i] == 'B' and s[i + 1] == 'R':
				s[i] = 'G'
			elif s[i] == 'G' and s[i + 1] == 'R':
				s[i] = 'B'
			elif s[i] == 'G' and s[i + 1] == 'B':
				s[i] = 'R'
		elif s[i] == 'R':
			s[i] = 'B'
		else:
			s[i] = 'R'
print(ans)
print(''.join(s))


n = int(input())
rgb = 'RGB'
s = input().strip()
mod_counts = {}
for c in rgb:
	mod_counts[c] = [0, 0, 0]
for (i, c) in enumerate(s):
	mod_counts[c][i % 3] += 1
maximal_map = {}
maximum_unchanged = 0
possible_maps = [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]]
for pm in possible_maps:
	current_count = mod_counts['R'][pm[0]] + mod_counts['G'][pm[1]] + mod_counts['B'][pm[2]]
	if current_count > maximum_unchanged:
		maximum_unchanged = current_count
		maximal_map = {0: rgb[pm.index(0)], 1: rgb[pm.index(1)], 2: rgb[pm.index(2)]}
number_changed = len(s) - maximum_unchanged
new_s = ''.join((maximal_map[i % 3] for i in range(len(s))))
print(number_changed)
print(new_s)


n = int(input())
s = input()
(ans, tmp_s) = min(((sum((x != y for (x, y) in zip(s, tmp_s * n))), tmp_s) for tmp_s in ('RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB')))
print(ans)
print((tmp_s * n)[:n])


import sys

def get_string():
	return sys.stdin.readline().strip()
n = int(input())
s = get_string()
r = 0
t = [''] * n
for i in range(n):
	t[i] = s[i]
for i in range(n - 1):
	if t[i] == t[i + 1]:
		r += 1
		if t[i] == 'R':
			if i + 2 < n and t[i + 2] != 'B':
				t[i + 1] = 'B'
			else:
				t[i + 1] = 'G'
		elif t[i] == 'B':
			if i + 2 < n and t[i + 2] != 'R':
				t[i + 1] = 'R'
			else:
				t[i + 1] = 'G'
		elif t[i] == 'G':
			if i + 2 < n and t[i + 2] != 'B':
				t[i + 1] = 'B'
			else:
				t[i + 1] = 'R'
print(r)
garland = ''
print(garland.join(t))


color = ['R', 'G', 'B']
n = int(input())
s = list(input())
i = 0
res = 0
while i < n - 1:
	if s[i] == s[i + 1]:
		res += 1
		color = ['R', 'G', 'B']
		color.remove(s[i])
		if i + 2 != n:
			try:
				color.remove(s[i + 2])
			except:
				pass
		s[i + 1] = color[0]
	i += 1
print(res)
print(''.join(s))


def girlyanda2():
	q = int(input())
	s = list(input())

	def change(l):
		if l == 'R':
			return 'G'
		if l == 'G':
			return 'B'
		if l == 'B':
			return 'R'

	def otherchange(l):
		if l == 'R':
			return 'G'
		if l == 'G':
			return 'B'
		if l == 'B':
			return 'R'

	def repeats(y, pos):
		c = 1
		for i in range(pos + 1, len(y)):
			if y[i] == y[pos]:
				c += 1
				pos += 1
			else:
				break
		return c
	c = 0
	i = 0
	while i != q:
		r = repeats(s, i)
		if r > 1:
			k = 1
			while k < r:
				s[i + k] = change(s[i + k])
				if (k == r - 1 and i + k + 1 < q) and s[i + k] == s[i + k + 1]:
					s[i + k] = otherchange(s[i + k])
				c += 1
				k += 2
		i += 1
	print(c)
	return ''.join(s)
print(girlyanda2())


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())
l1 = input()
l2 = l1
l1 = list(l1)
l2 = list(l2)
c = {'R', 'G', 'B'}
q = 0
l1.append('B')
for i in range(n - 1):
	if l1[i] == l1[i + 1]:
		tempSet = {l1[i], l1[i + 1], l1[i + 2]}
		Sub = list(c - (c & {l1[i], l1[i + 1], l1[i + 2]}))
		l1[i + 1] = Sub[0]
		q = q + 1
l1.pop()
print(q)
print(''.join(l1))


q = int(input())
xd = input()
c = list(xd)
t = ['RGB', 'RBG', 'GBR', 'GRB', 'BGR', 'BRG']
idx = 0
ctr = [0] * 6
for (i, letter) in enumerate(c):
	if i % 3 == 0:
		if letter == 'R':
			ctr[0] += 1
			ctr[1] += 1
		elif letter == 'G':
			ctr[2] += 1
			ctr[3] += 1
		else:
			ctr[4] += 1
			ctr[5] += 1
	elif i % 3 == 1:
		if letter == 'R':
			ctr[3] += 1
			ctr[5] += 1
		elif letter == 'G':
			ctr[0] += 1
			ctr[4] += 1
		else:
			ctr[1] += 1
			ctr[2] += 1
	elif letter == 'R':
		ctr[2] += 1
		ctr[4] += 1
	elif letter == 'G':
		ctr[1] += 1
		ctr[5] += 1
	else:
		ctr[0] += 1
		ctr[3] += 1
m = ctr[0]
for i in range(6):
	if ctr[i] > m:
		m = ctr[i]
		idx = i
print(len(c) - m)
s = t[idx] * (len(c) // 3)
if len(c) % 3 == 1:
	s += t[idx][0]
elif len(c) % 3 == 2:
	s += t[idx][0]
	s += t[idx][1]
print(s)


n = int(input())
s = list(input())
so = s[0]
COUNT = 0
for i in range(1, n):
	if s[i] != so:
		so = s[i]
		continue
	elif i != n - 1:
		if so == 'R' and s[i + 1] == 'R':
			s[i] = 'G'
		if so == 'G' and s[i + 1] == 'G':
			s[i] = 'B'
		if so == 'B' and s[i + 1] == 'B':
			s[i] = 'R'
		if so == 'R' and s[i + 1] == 'G' or (so == 'G' and s[i + 1] == 'R'):
			s[i] = 'B'
		if so == 'R' and s[i + 1] == 'B' or (so == 'B' and s[i + 1] == 'R'):
			s[i] = 'G'
		if so == 'B' and s[i + 1] == 'G' or (so == 'G' and s[i + 1] == 'B'):
			s[i] = 'R'
		so = s[i]
		COUNT += 1
	else:
		COUNT += 1
		if s[i - 1] == 'R' or s[i - 1] == 'B':
			s[i] = 'G'
		if s[i - 1] == 'G':
			s[i] = 'R'
print(COUNT)
print(''.join(s))


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'
		elif 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')


def okde(a, b, c='0'):
	if c == '0' or a == c:
		if a == 'R':
			return 'B'
		if a == 'B':
			return 'R'
		if a == 'G':
			return 'B'
	if a == 'B' and c == 'R':
		b = 'G'
	if a == 'B' and c == 'G':
		b = 'R'
	if a == 'G' and c == 'B':
		b = 'R'
	if a == 'G' and c == 'R':
		b = 'B'
	if a == 'R' and c == 'B':
		b = 'G'
	if a == 'R' and c == 'G':
		b = 'B'
	return b
n = int(input())
flag = 0
ss = input()
song = list(ss)
an = [song[0]]
for i in range(0, n - 1 + 1 - 1):
	ans = ''
	if song[i] == song[i + 1]:
		flag += 1
		if i != n - 2:
			ans = okde(song[i], song[i + 1], song[i + 2])
		else:
			ans = okde(song[i], song[i + 1])
		song[i + 1] = ans
		an.append(ans)
	else:
		an.append(song[i + 1])
song = ''.join(an)
print(flag)
print(song)


I = input
n = int(I())
s = list(I())
t = ''
t1 = s[0]
i = 0
run = True
while run:
	if s[i] != t1:
		run = False
		t = list({'R', 'B', 'G'} - (set(t1) | set(s[i])))[0]
	i += 1
	if i >= n:
		break
if t == '':
	t = 'R' if 'R' != s[0] else 'B'
count = 0
for i in range(n - 1):
	if s[i] == s[i + 1]:
		s[i + 1] = t if i + 2 >= n or (i + 2 < n and s[i + 2] != t) else list({'R', 'B', 'G'} - (set(t) | set(s[i])))[0]
		count += 1
	else:
		t = s[i]
print(count)
print(''.join(s))


l = int(input())
a = list(input())
col = ['R', 'G', 'B']
cnt = 0
for i in range(0, l - 2):
	if a[i] == a[i + 1] and a[i + 1] == a[i + 2]:
		cnt += 1
		if a[i + 1] == 'R':
			a[i + 1] = 'B'
		else:
			a[i + 1] = 'R'
for i in range(0, l - 1):
	if a[i] == a[i + 1]:
		cnt += 1
		if i == 0:
			if a[i + 1] == 'R':
				a[i] = 'B'
			else:
				a[i] = 'R'
		else:
			for j in range(0, 3):
				if col[j] != a[i - 1] and col[j] != a[i + 1]:
					a[i] = col[j]
					break
print(cnt)
for i in range(0, l):
	print(a[i], end='')


l = ['RG', 'GB', 'BR', 'BG', 'RB', 'GR']
l1 = ['RGB', 'BRG', 'GBR', 'BGR', 'RBG', 'GRB']
n = int(input())
k = input()
co = []
d = 0
for i in range(len(l1)):
	l1[i] *= n
for i in range(len(l1)):
	for j in range(n):
		if k[j] != l1[i][j]:
			d += 1
	co.append([d, l1[i]])
	d = 0
co = sorted(co, key=lambda x: x[0])
print(co[0][0])
print(co[0][1][:n])


n = int(input())
c = input()
b = []
for j in c:
	b.append(j)
p = 0
if n == 1:
	print(0)
	print(c)
else:
	for j in range(n - 2):
		if b[j] == b[j + 1]:
			if b[j] == 'R' and b[j + 2] == 'B':
				b[j + 1] = 'G'
			elif b[j] == 'R' and b[j + 2] == 'G':
				b[j + 1] = 'B'
			elif b[j] == 'B' and b[j + 2] == 'G':
				b[j + 1] = 'R'
			elif b[j] == 'B' and b[j + 2] == 'R':
				b[j + 1] = 'G'
			elif b[j] == 'G' and b[j + 2] == 'B':
				b[j + 1] = 'R'
			elif b[j] == 'G' and b[j + 2] == 'R':
				b[j + 1] = 'B'
			elif b[j] == 'R' and b[j + 2] == 'R':
				b[j + 1] = 'G'
			elif b[j] == 'B' and b[j + 2] == 'B':
				b[j + 1] = 'G'
			elif b[j] == 'G' and b[j + 2] == 'G':
				b[j + 1] = 'R'
			p += 1
	if b[-1] == b[-2]:
		if b[-1] == 'R':
			b[-1] = 'G'
		elif b[-1] == 'G':
			b[-1] = 'R'
		elif b[-1] == 'B':
			b[-1] = 'R'
		p += 1
	print(p)
	print(''.join(b))


n = int(input())
s = input()
s1 = 'RGB'
s2 = 'GBR'
s3 = 'RBG'
s4 = 'GRB'
s5 = 'BGR'
s6 = 'BRG'
k = n % 3
t = n // 3
s1 = s1 * t + s1[:k]
s2 = s2 * t + s2[:k]
s3 = s3 * t + s3[:k]
s4 = s4 * t + s4[:k]
s5 = s5 * t + s5[:k]
s6 = s6 * t + s6[:k]
t1 = 0
t2 = 0
t3 = 0
t4 = 0
t5 = 0
t6 = 0
for i in range(n):
	if s[i] != s1[i]:
		t1 = t1 + 1
	if s[i] != s2[i]:
		t2 = t2 + 1
	if s[i] != s3[i]:
		t3 = t3 + 1
	if s[i] != s4[i]:
		t4 = t4 + 1
	if s[i] != s5[i]:
		t5 = t5 + 1
	if s[i] != s6[i]:
		t6 = t6 + 1
r = min(t1, t2, t3, t4, t5, t6)
print(r)
if r == t1:
	print(s1)
elif r == t2:
	print(s2)
elif r == t3:
	print(s3)
elif r == t4:
	print(s4)
elif r == t5:
	print(s5)
else:
	print(s6)


n = int(input())
s = input().strip()
nice = {0: 'R', 1: 'G', 2: 'B'}
nice_line = ''
min_moves = 3000000
for i in range(3):
	line = ''
	moves = 0
	for j in range(n):
		if nice[(j + i) % 3] != s[j]:
			moves += 1
			line += nice[(i + j) % 3]
		else:
			line += s[j]
	if moves < min_moves:
		min_moves = moves
		nice_line = line
nice = {0: 'G', 1: 'R', 2: 'B'}
for i in range(3):
	line = ''
	moves = 0
	for j in range(n):
		if nice[(j + i) % 3] != s[j]:
			moves += 1
			line += nice[(i + j) % 3]
		else:
			line += s[j]
	if moves < min_moves:
		min_moves = moves
		nice_line = line
print(min_moves)
print(nice_line)


def tran(s):
	if s == 'R':
		return 0
	if s == 'B':
		return 1
	if s == 'G':
		return 2
	assert False

def main():
	(n, s) = (int(input()), [tran(c) for c in input()])
	dp = [[0, 0, 0] for _ in range(n)]
	f = [[-1, -1, -1] for _ in range(n)]
	dp[0] = [1, 1, 1]
	dp[0][s[0]] = 0
	for i in range(1, n):
		if s[i] == 0:
			(dp[i][0], f[i][0]) = min((dp[i - 1][1], 1), (dp[i - 1][2], 2))
			(dp[i][1], f[i][1]) = min((dp[i - 1][0] + 1, 0), (dp[i - 1][2] + 1, 2))
			(dp[i][2], f[i][2]) = min((dp[i - 1][0] + 1, 0), (dp[i - 1][1] + 1, 1))
		elif s[i] == 1:
			(dp[i][1], f[i][1]) = min((dp[i - 1][0], 0), (dp[i - 1][2], 2))
			(dp[i][0], f[i][0]) = min((dp[i - 1][1] + 1, 1), (dp[i - 1][2] + 1, 2))
			(dp[i][2], f[i][2]) = min((dp[i - 1][0] + 1, 0), (dp[i - 1][1] + 1, 1))
		elif s[i] == 2:
			(dp[i][2], f[i][2]) = min((dp[i - 1][0], 0), (dp[i - 1][1], 1))
			(dp[i][0], f[i][0]) = min((dp[i - 1][1] + 1, 1), (dp[i - 1][2] + 1, 2))
			(dp[i][1], f[i][1]) = min((dp[i - 1][0] + 1, 0), (dp[i - 1][2] + 1, 2))
		else:
			assert False
	i = 0
	if dp[n - 1][1] < dp[n - 1][i]:
		i = 1
	if dp[n - 1][2] < dp[n - 1][i]:
		i = 2
	print(dp[n - 1][i])
	s = ''
	while i != -1:
		if i == 0:
			s += 'R'
		if i == 1:
			s += 'B'
		if i == 2:
			s += 'G'
		i = f[-len(s)][i]
	print(s[::-1])
main()


def other_color(a, b):
	return list(set(list('RGB')) - set([a, b]))[0]
n = int(input())
s = input()
cnt = 0
prev = None
l = []
for i in s:
	if prev is None:
		prev = i
		cnt += 1
		continue
	if i != prev:
		l.append([cnt, prev])
		cnt = 1
		prev = i
	else:
		cnt += 1
l.append([cnt, prev])
count = 0
ans = ''
for (ind, i) in enumerate(l):
	count += i[0] // 2
	now_c = i[1]
	if ind == len(l) - 1:
		use_c = other_color(now_c, '')
	else:
		use_c = other_color(now_c, l[ind + 1][1])
	ans += ''.join([now_c if i % 2 == 0 else use_c for i in range(i[0])])
print(count)
print(ans)


n = int(input())
s = input()
s += ' '
new = s[0]
count = 0
for i in range(1, n):
	if s[i] == new[i - 1]:
		count += 1
		if s[i] == 'R':
			if s[i + 1] == 'G':
				new += 'B'
			else:
				new += 'G'
		elif s[i] == 'B':
			if s[i + 1] == 'G':
				new += 'R'
			else:
				new += 'G'
		elif s[i + 1] == 'R':
			new += 'B'
		else:
			new += 'R'
	else:
		new += s[i]
print(count)
print(new)


from itertools import permutations
n = int(input())
s = list(input())
if n == 1:
	print(0)
	print(''.join(s))
elif n == 2:
	if s[0] == s[1]:
		print(1)
		if s[0] == 'R':
			s[1] = 'G'
		elif s[0] == 'B':
			s[1] = 'G'
		elif s[0] == 'G':
			s[1] = 'B'
		print(''.join(s))
else:
	W = 'RGB'
	k = list(permutations(W))
	for i in range(len(k)):
		k[i] = str(''.join(k[i]))
	o = n // 3
	z = n % 3
	for i in range(len(k)):
		d = k[i] * o + k[i][:z]
		cost = 0
		for j in range(len(d)):
			if d[j] != s[j]:
				cost += 1
		k[i] = [cost, d]
	k = sorted(k)
	print(k[0][0])
	print(k[0][1])


n = int(input())
rgb = 'RGB'
s = input().strip()

def different(a, b):
	for c in rgb:
		if c != a and c != b:
			return c
number_changed = 0
new_s = list(s)
for i in range(1, len(new_s) - 1):
	if new_s[i] == new_s[i - 1]:
		new_s[i] = different(new_s[i], new_s[i + 1])
		number_changed += 1
if len(new_s) > 1:
	if new_s[-2] == new_s[-1]:
		new_s[-1] = different(new_s[-1], new_s[-1])
		number_changed += 1
new_s = ''.join(new_s)
print(number_changed)
print(new_s)


a = int(input())
b = list(input())
f = 0
for k in range(a - 2):
	if b[k] == b[k + 1]:
		n = ['R', 'G', 'B']
		if b[k] in n:
			n.remove(b[k])
		if b[k + 2] in n:
			n.remove(b[k + 2])
		b[k + 1] = n[0]
		f += 1
if a > 1:
	if b[-1] == b[-2]:
		n = ['R', 'G', 'B']
		n.remove(b[-2])
		b[-1] = n[0]
		f += 1
print(f)
print(''.join(b))


r = [0, 0, 0]
b = [0, 0, 0]
g = [0, 0, 0]
n = int(input())
a = list(input())
for i in range(n):
	if a[i] == 'R':
		r[i % 3] += 1
	elif a[i] == 'B':
		b[i % 3] += 1
	elif a[i] == 'G':
		g[i % 3] += 1
(ri, gi, bi) = (0, 1, 2)
(rr, bb, gg) = (0, 0, 0)
mx = 0
for i in range(3):
	for j in range(3):
		for k in range(3):
			if i != j and j != k and (k != i):
				(ri, bi, gi) = (i, j, k)
				x = r[ri] + b[bi] + g[gi]
				if x > mx:
					rr = ri
					bb = bi
					gg = k
					mx = x
ch = 0
for i in range(n):
	if i % 3 == rr and a[i] != 'R':
		a[i] = 'R'
		ch += 1
	if i % 3 == bb and a[i] != 'B':
		a[i] = 'B'
		ch += 1
	if i % 3 == gg and a[i] != 'G':
		a[i] = 'G'
		ch += 1
print(ch)
print(''.join(a))


n = int(input())
s = list(input())
a = set('RGB')
c = 0
for i in range(1, n - 1):
	if s[i] == s[i - 1]:
		b = a - set(s[i - 1] + s[i + 1])
		s[i] = list(b)[0]
		c += 1
if n != 1 and s[-2] == s[-1]:
	b = a - set(s[-1])
	s[-1] = list(b)[0]
	c += 1
print(c)
print(*s, sep='')


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()
dp = [[0] * 3 for _ in range(n)]
if s[0] == 'R':
	dp[0][1] = 1
	dp[0][2] = 1
elif s[0] == 'G':
	dp[0][0] = 1
	dp[0][2] = 1
else:
	dp[0][0] = 1
	dp[0][1] = 1
track = [[0] * 3 for _ in range(n)]
for i in range(1, n):
	if dp[i - 1][1] <= dp[i - 1][2]:
		dp[i][0] = dp[i - 1][1] + (1 if s[i] != 'R' else 0)
		track[i][0] = 1
	else:
		dp[i][0] = dp[i - 1][2] + (1 if s[i] != 'R' else 0)
		track[i][0] = 2
	if dp[i - 1][0] <= dp[i - 1][2]:
		dp[i][1] = dp[i - 1][0] + (1 if s[i] != 'G' else 0)
		track[i][1] = 0
	else:
		dp[i][1] = dp[i - 1][2] + (1 if s[i] != 'G' else 0)
		track[i][1] = 2
	if dp[i - 1][0] <= dp[i - 1][1]:
		dp[i][2] = dp[i - 1][0] + (1 if s[i] != 'B' else 0)
		track[i][2] = 0
	else:
		dp[i][2] = dp[i - 1][1] + (1 if s[i] != 'B' else 0)
		track[i][2] = 1
ans = []
for i in range(3):
	if dp[-1][i] == min(dp[-1]):
		now = i
		break
for i in range(n - 1, -1, -1):
	if now == 0:
		ans.append('R')
	elif now == 1:
		ans.append('G')
	else:
		ans.append('B')
	now = track[i][now]
print(min(dp[-1]))
print(''.join(ans)[::-1])


n = int(input())
s = list(input())
count = 0
k = 1
if len(s) == 1:
	print('0')
	print(''.join(s))
for i in range(n - 2):
	if s[i] == s[i + 1]:
		if s[i + 2] == 'G' and s[i] == 'R':
			s[i + 1] = 'B'
		elif s[i + 2] == 'G' and s[i] == 'B':
			s[i + 1] = 'R'
		elif s[i + 2] == 'B' and s[i] == 'R':
			s[i + 1] = 'G'
		elif s[i + 2] == 'B' and s[i] == 'G':
			s[i + 1] = 'R'
		elif s[i + 2] == 'R' and s[i] == 'B':
			s[i + 1] = 'G'
		elif s[i + 2] == 'R' and s[i] == 'G':
			s[i + 1] = 'B'
		elif s[i] == 'B':
			s[i + 1] = 'G'
		elif s[i] == 'G':
			s[i + 1] = 'R'
		else:
			s[i + 1] = 'B'
		k = k + 1
		t = i
	else:
		count = count + k // 2
		k = 1
count = count + k // 2
if s[n - 2] == s[n - 1]:
	if s[n - 2] == 'B':
		s[n - 1] = 'G'
	elif s[n - 2] == 'G':
		s[n - 1] = 'R'
	else:
		s[n - 1] = 'B'
	count = count + 1
if len(s) > 1:
	print(count)
	print(''.join(s))


(n, s) = (int(input()), list(input() + '_'))
c = list('RGB')
cnt = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		s[i] = (set(c) - {s[i - 1], s[i + 1]}).pop()
		cnt += 1
print(cnt)
print(''.join(s[:-1]))


import sys, math, collections
n = int(input())
a = list(input())
i = 0
ans = 0
while i < n - 1:
	if a[i] == a[i + 1]:
		temp = ['R', 'G', 'B']
		temp.remove(a[i])
		if i < n - 2:
			if temp.count(a[i + 2]):
				temp.remove(a[i + 2])
		a[i + 1] = temp[0]
		ans += 1
		i += 1
	i += 1
print(ans)
print(*a, sep='')


def main():
	n = int(input())
	s = input()
	a = [[], [], []]
	for i in range(len(s)):
		a[i % 3].append(s[i])
	ans = 1000 * 1000 * 1000
	loop = ''
	s = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
	for t in s:
		tmp = 0
		tmp += len(a[0]) - a[0].count(t[0])
		tmp += len(a[1]) - a[1].count(t[1])
		tmp += len(a[2]) - a[2].count(t[2])
		if tmp < ans:
			ans = tmp
			loop = t
	print(ans)
	print(loop * (n // 3) + loop[:n % 3])
main()


from collections import Counter

def read_nums():
	return [int(x) for x in input().split()]

def calculate_changes(one, two, s):
	res = 0
	three = [x for x in 'RGB' if x not in (one, two)][0]
	target = [one, two, three]
	for (index, ch) in enumerate(s):
		if ch != target[index % 3]:
			res += 1
	return res

def print_sequence(one, two, n):
	three = [x for x in 'RGB' if x not in (one, two)][0]
	target = [one, two, three]
	res = []
	for i in range(n):
		res.append(target[i % 3])
	print(''.join(res))

def main():
	(n,) = read_nums()
	s = input()
	counts = []
	for one in 'RGB':
		for two in 'RGB':
			if one == two:
				continue
			count = calculate_changes(one, two, s)
			counts.append((one, two, count))
	(one, two, count) = min(counts, key=lambda x: x[2])
	print(count)
	print_sequence(one, two, n)
main()


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='')


from sys import stdin
n = int(stdin.readline().strip())
s = list(stdin.readline().strip())
s1 = s[0]
arr = ['R', 'G', 'B']
ans = 0
for i in range(1, n - 1):
	if s[i] == s[i + 1] and s[i] == s[i - 1]:
		ans += 1
		for j in arr:
			if s[i] != j:
				s[i] = j
				break
for i in range(1, n):
	if s[i] == s[i - 1]:
		ans += 1
		for j in arr:
			if s[i - 1] != j and (i == n - 1 or s[i + 1] != j):
				s[i] = j
				break
	s1 += s[i]
print(ans)
print(s1)


n = int(input())
s = str(input())
l = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
p = n
for i in l:
	x = 0
	c = i * (n // 3) + i[:n % 3]
	for j in range(n):
		if c[j] != s[j]:
			x += 1
	if p >= x:
		p = x
		ans = c
print(p)
print(ans)


n = int(input())
s = list(input())
a1 = []
a2 = []
a3 = []
a4 = []
a5 = []
a6 = []
for each in range(len(s)):
	if each % 3 == 0:
		a1.append('R')
		a2.append('G')
		a3.append('B')
		a4.append('R')
		a5.append('B')
		a6.append('G')
	elif each % 3 == 1:
		a1.append('G')
		a2.append('B')
		a3.append('R')
		a4.append('B')
		a5.append('G')
		a6.append('R')
	else:
		a1.append('B')
		a2.append('R')
		a3.append('G')
		a4.append('G')
		a5.append('R')
		a6.append('B')
(c1, c2, c3, c4, c5, c6) = (0, 0, 0, 0, 0, 0)
for num in range(0, n):
	if s[num] == a1[num]:
		c1 += 1
	if s[num] == a2[num]:
		c2 += 1
	if s[num] == a3[num]:
		c3 += 1
	if s[num] == a4[num]:
		c4 += 1
	if s[num] == a5[num]:
		c5 += 1
	if s[num] == a6[num]:
		c6 += 1
if c1 == max(c1, c2, c3, c4, c5, c6):
	print(len(s) - c1)
	for x in a1:
		print(x, end='')
elif c2 == max(c1, c2, c3, c4, c5, c6):
	print(len(s) - c2)
	for x in a2:
		print(x, end='')
elif c3 == max(c1, c2, c3, c4, c5, c6):
	print(len(s) - c3)
	for x in a3:
		print(x, end='')
elif c4 == max(c1, c2, c3, c4, c5, c6):
	print(len(s) - c4)
	for x in a4:
		print(x, end='')
elif c5 == max(c1, c2, c3, c4, c5, c6):
	print(len(s) - c5)
	for x in a5:
		print(x, end='')
else:
	print(len(s) - c6)
	for x in a6:
		print(x, end='')


n = int(input())
gi = list(input())
if n == 1:
	print(0)
	print(gi[0])
	exit(0)
coun = 0
for i in range(n - 2):
	cho = ['R', 'G', 'B']
	if gi[i] == gi[i + 1]:
		cho.remove(gi[i])
		if gi[i + 2] != gi[i]:
			cho.remove(gi[i + 2])
		gi[i + 1] = cho[0]
		coun += 1
if gi[-1] == gi[-2]:
	cho = ['R', 'G', 'B']
	cho.remove(gi[-2])
	gi[-1] = cho[0]
	coun += 1
print(coun)
print(''.join(gi))


import sys, os
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))
MOD = 10 ** 9 + 7

def f(a, b):
	for i in ['R', 'G', 'B']:
		if not i in (a, b):
			return i

def main():
	n = int(input())
	arr = list(input().strip())
	dp = [{'R': 0, 'G': 0, 'B': 0} for i in range(n)]
	for i in ['R', 'G', 'B']:
		dp[0][i] = [1, 0][i == arr[0]]
	for i in range(1, n):
		for j in ['R', 'G', 'B']:
			if j == arr[i]:
				dp[i][j] = min([dp[i - 1][k] for k in ['R', 'G', 'B'] if k != j])
			else:
				dp[i][j] = 1 + min([dp[i - 1][k] for k in ['R', 'G', 'B'] if k != j])
	print(min(dp[n - 1].values()))
	last = '*'
	ans = [0] * n
	for i in range(n - 1, -1, -1):
		t_m = 10 ** 9
		tem = '*'
		for j in ['R', 'G', 'B']:
			if last != j:
				if t_m > dp[i][j]:
					tem = j
					t_m = dp[i][j]
		last = tem
		ans[i] = last
	print(''.join(ans))
main()


n = int(input())
s = input()
if n == 2:
	if s[0] == s[1]:
		print(1)
		if s[0] == 'R':
			print('RG')
		if s[0] == 'G':
			print('GR')
		if s[0] == 'B':
			print('BR')
	else:
		print(0)
		print(s)
elif n == 1:
	print(0)
	print(s)
else:
	s1 = ['RGB' * int(n / 2), 'RBG' * int(n / 2), 'GRB' * int(n / 2), 'GBR' * int(n / 2), 'BRG' * int(n / 2), 'BGR' * int(n / 2)]
	c = [0] * 6
	for i in range(len(s)):
		for j in range(len(s1)):
			if s1[j][i] != s[i]:
				c[j] = c[j] + 1
	print(min(c))
	v = c.index(min(c))
	print(s1[v][:len(s)])


from collections import Counter
from itertools import permutations
n = int(input())
s = input().lower()
c1 = Counter(s[::3])
c2 = Counter(s[1::3])
c3 = Counter(s[2::3])
(r1, r2) = max(((c1[t1] + c2[t2] + c3[t3], t1 + t2 + t3) for (t1, t2, t3) in permutations('rgb')))
print(n - r1)
print((r2 * n)[:n].upper())


length = eval(input())
l = input()
l = list(l)
l1 = l.copy()
l2 = l.copy()
l3 = l.copy()
l4 = l.copy()
l5 = l.copy()
l6 = l.copy()
i = 0
n1 = 0
n2 = 0
n3 = 0
n4 = 0
n5 = 0
n6 = 0
while i < length:
	if l1[i] != 'R':
		l1[i] = 'R'
		n1 += 1
	if i + 1 < length:
		if l1[i + 1] != 'G':
			l1[i + 1] = 'G'
			n1 += 1
	if i + 2 < length:
		if l1[i + 2] != 'B':
			l1[i + 2] = 'B'
			n1 += 1
	i += 3
i = 0
while i < length:
	if l4[i] != 'R':
		l4[i] = 'R'
		n4 += 1
	if i + 1 < length:
		if l4[i + 1] != 'B':
			l4[i + 1] = 'B'
			n4 += 1
	if i + 2 < length:
		if l4[i + 2] != 'G':
			l4[i + 2] = 'G'
			n4 += 1
	i += 3
i = 0
while i < length:
	if l2[i] != 'G':
		l2[i] = 'G'
		n2 += 1
	if i + 1 < length:
		if l2[i + 1] != 'B':
			l2[i + 1] = 'B'
			n2 += 1
	if i + 2 < length:
		if l2[i + 2] != 'R':
			l2[i + 2] = 'R'
			n2 += 1
	i += 3
i = 0
while i < length:
	if l5[i] != 'G':
		l5[i] = 'G'
		n5 += 1
	if i + 1 < length:
		if l5[i + 1] != 'R':
			l5[i + 1] = 'R'
			n5 += 1
	if i + 2 < length:
		if l5[i + 2] != 'B':
			l5[i + 2] = 'B'
			n5 += 1
	i += 3
i = 0
while i < length:
	if l3[i] != 'B':
		l3[i] = 'B'
		n3 += 1
	if i + 1 < length:
		if l3[i + 1] != 'R':
			l3[i + 1] = 'R'
			n3 += 1
	if i + 2 < length:
		if l3[i + 2] != 'G':
			l3[i + 2] = 'G'
			n3 += 1
	i += 3
i = 0
while i < length:
	if l6[i] != 'B':
		l6[i] = 'B'
		n6 += 1
	if i + 1 < length:
		if l6[i + 1] != 'G':
			l6[i + 1] = 'G'
			n6 += 1
	if i + 2 < length:
		if l6[i + 2] != 'R':
			l6[i + 2] = 'R'
			n6 += 1
	i += 3
if n1 < n2 and n1 < n3 and (n1 < n4) and (n1 < n5) and (n1 < n6):
	print(n1)
	print(''.join(l1))
elif n2 < n3 and n2 < n4 and (n2 < n5) and (n2 < n6):
	print(n2)
	print(''.join(l2))
elif n3 < n4 and n3 < n5 and (n3 < n6):
	print(n3)
	print(''.join(l3))
elif n4 < n5 and n4 < n6:
	print(n4)
	print(''.join(l4))
elif n5 < n6:
	print(n5)
	print(''.join(l5))
else:
	print(n6)
	print(''.join(l6))


l = ['R', 'G', 'B']
n = int(input())
s = str(input())
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if s[0] == s[1]:
		print(1)
		x = s[0]
		for i in l:
			if i != s[0]:
				x += i
				break
		print(x)
	else:
		print(0)
		print(s)
else:
	(a, b, c, d, e, f) = ('RGB', 'RBG', 'BGR', 'BRG', 'GRB', 'GBR')
	i = 0
	while n > 3:
		a += a[i % 3]
		b += b[i % 3]
		c += c[i % 3]
		d += d[i % 3]
		e += e[i % 3]
		f += f[i % 3]
		n -= 1
		i += 1
	ans = [0, 0, 0, 0, 0, 0]
	for i in range(len(s)):
		if s[i] != a[i]:
			ans[0] += 1
		if s[i] != b[i]:
			ans[1] += 1
		if s[i] != c[i]:
			ans[2] += 1
		if s[i] != d[i]:
			ans[3] += 1
		if s[i] != e[i]:
			ans[4] += 1
		if s[i] != f[i]:
			ans[5] += 1
	(m, i) = min(((v, i) for (i, v) in enumerate(ans)))
	print(m)
	if i == 0:
		print(a)
	elif i == 1:
		print(b)
	elif i == 2:
		print(c)
	elif i == 3:
		print(d)
	elif i == 4:
		print(e)
	else:
		print(f)


def string(q, w):
	r = 0
	for i in range(len(q)):
		if q[i] != w[i]:
			r = r + 1
	return r
n = int(input())
a = input()
b = 'GRB' * (n // 3) + 'GRB'[:n % 3]
c = 'RGB' * (n // 3) + 'RGB'[:n % 3]
d = 'RBG' * (n // 3) + 'RBG'[:n % 3]
e = 'GBR' * (n // 3) + 'GBR'[:n % 3]
f = 'BRG' * (n // 3) + 'BRG'[:n % 3]
g = 'BGR' * (n // 3) + 'BRG'[:n % 3]
h = string(a, b)
i = string(a, c)
j = string(a, d)
k = string(a, e)
l = string(a, f)
m = string(a, g)
if min(h, i, j, k, l, m) == h:
	print(h)
	print(b)
elif min(h, i, j, k, l, m) == i:
	print(i)
	print(c)
elif min(h, i, j, k, l, m) == j:
	print(j)
	print(d)
elif min(h, i, j, k, l, m) == k:
	print(k)
	print(e)
elif min(h, i, j, k, l, m) == l:
	print(l)
	print(f)
elif min(h, i, j, k, l, m) == m:
	print(m)
	print(g)


n = int(input())
s = input()
t = 0
li = ['G', 'R', 'B']
ans = s[0]
for i in range(1, n):
	x = s[i]
	if x == ans[i - 1]:
		t += 1
		if i < n - 1:
			z = s[i + 1]
			for y in li:
				if y != x and y != z:
					ans += y
					break
		else:
			for y in li:
				if y != x:
					ans += y
					break
	else:
		ans += x
print(t)
print(ans)


from os import path
import sys
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def func(a, x):
	ans = 0
	n = len(a)
	for i in range(n, 0, -1):
		x1 = (1 << i) - 1
		if x >= x1:
			ans += a[i - 1]
			x -= x1
			if x > 0:
				ans += a[i] % (2 * a[i - 1])
				x -= 1
	return ans

def solve():
	ans = 0
	n = ii()
	s = list(si())
	if n == 1:
		print(0)
		print(s[0])
		exit(0)
	for i in range(1, n - 1):
		if s[i] == s[i - 1]:
			for j in ['R', 'G', 'B']:
				if j != s[i - 1] and j != s[i + 1]:
					s[i] = j
					ans += 1
					break
	if s[n - 1] == s[n - 2]:
		ans += 1
		for j in ['R', 'G', 'B']:
			if j != s[n - 1]:
				s[n - 1] = j
				break
	print(ans)
	print(''.join(s))
solve()


def solve(n, s):
	possibilities = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
	for index in range(len(possibilities)):
		possibilities[index] = (possibilities[index], 0)
	for index in range(n):
		char = s[index]
		for i in range(len(possibilities)):
			(possibility, nb_changes) = possibilities[i]
			if possibility[index % 3] != char:
				possibilities[i] = (possibility, nb_changes + 1)
	possibilities = sorted(possibilities, key=lambda x: x[1])
	(possibility, nb_changes) = possibilities[0]
	s_updated = possibility
	while len(s_updated) < n:
		s_updated += possibility
	return (nb_changes, s_updated[:n])
n = int(input())
s = input().strip()
(nb_changes, s_updated) = solve(n, s)
print('{} {}'.format(nb_changes, s_updated))


n = int(input())
s = list(input())
last = ''
c = 0
for i in range(n):
	if s[i] == last:
		if i == n - 1:
			if last == 'R':
				s[i] = 'G'
			elif last == 'B':
				s[i] = 'G'
			else:
				s[i] = 'R'
		elif last == 'R':
			if s[i + 1] == 'B':
				s[i] = 'G'
			else:
				s[i] = 'B'
		elif last == 'B':
			if s[i + 1] == 'G':
				s[i] = 'R'
			else:
				s[i] = 'G'
		elif s[i + 1] == 'R':
			s[i] = 'B'
		else:
			s[i] = 'R'
		c += 1
	last = s[i]
print(c)
print(''.join(s))


n = int(input())
s = input()
s += 'G'
anscount = 0
ans = s[0]
color = 'RGB'
for i in range(n - 1):
	if s[i + 1] == ans[i]:
		anscount += 1
		flag = [0, 0, 0]
		for j in range(3):
			if color[j] == s[i + 2] or color[j] == ans[i]:
				flag[j] = 1
		for j in range(3):
			if flag[j] == 0:
				ans += color[j]
				break
	else:
		ans += s[i + 1]
print(anscount)
print(ans)


n = int(input())
g = list(input())
cost = 0
for i in range(1, n):
	if g[i] == g[i - 1]:
		cost += 1
		if i == n - 1 or g[i] == g[i + 1]:
			if g[i] == 'R':
				g[i] = 'G'
			elif g[i] == 'G':
				g[i] = 'B'
			else:
				g[i] = 'R'
		elif g[i] == 'R' and g[i + 1] == 'G':
			g[i] = 'B'
		elif g[i] == 'R' and g[i + 1] == 'B':
			g[i] = 'G'
		elif g[i] == 'G' and g[i + 1] == 'R':
			g[i] = 'B'
		elif g[i] == 'G' and g[i + 1] == 'B':
			g[i] = 'R'
		elif g[i] == 'B' and g[i + 1] == 'R':
			g[i] = 'G'
		else:
			g[i] = 'R'
print(cost)
print(''.join(g))


n = int(input())
A = input()
B = [[-1, -1, -1] for _ in range(len(A))]
cols = 'RGB'
B[0] = [A[0] != 'R', A[0] != 'G', A[0] != 'B']
for i in range(1, len(A)):
	for j in range(3):
		B[i][j] = min([B[i - 1][(j + 1) % 3], B[i - 1][(j + 2) % 3]]) + (A[i] != cols[j])
best = min(B[n - 1])
best_ind = B[n - 1].index(best)
result = []
tmp = best
for i in range(n - 1, -1, -1):
	result += cols[best_ind]
	if cols[best_ind] != A[i]:
		tmp -= 1
	if i > 0:
		if B[i - 1][(best_ind + 1) % 3] == tmp:
			best_ind = (best_ind + 1) % 3
		else:
			best_ind = (best_ind + 2) % 3
result.reverse()
print(int(best))
print(''.join(result))


n = int(input())
s = input()
k = n // 3
k += 1
a = ['RGB' * k, 'RBG' * k, 'BRG' * k, 'BGR' * k, 'GRB' * k, 'GBR' * k]
mine = 10 ** 15
st = ''
for j in range(6):
	t = a[j]
	res = 0
	for i in range(n):
		if s[i] != t[i]:
			res += 1
	if res < mine:
		mine = res
		st = t
print(mine)
print(st[0:n])


n = int(input())
s = input()
x = ['RGB', 'RBG', 'GBR', 'GRB', 'BGR', 'BRG']
if n == 1:
	print('0')
	print(s)
elif n == 2:
	if s[0] == s[1]:
		print('1')
		if s[0] == 'R':
			print('RG')
		else:
			print('BG')
	else:
		print('0')
		print(s)
else:
	c = n
	ans = 0
	for i in range(0, 6):
		ans = 0
		for j in range(0, n):
			if x[i][j % 3] == s[j]:
				continue
			else:
				ans += 1
		if ans < c:
			d = i
			c = ans
	print(c)
	for j in range(0, n):
		print(x[d][j % 3], end='')


n = int(input())
a = list(input())
sl = ['R', 'B', 'G']
count = 0
for i in range(n - 1):
	if a[i] == a[i + 1]:
		rp = []
		count += 1
		if a[i] != sl[0]:
			rp.append(sl[0])
		if a[i] != sl[1]:
			rp.append(sl[1])
		if a[i] != sl[2]:
			rp.append(sl[2])
		if i < n - 2:
			kk = a[i + 2]
			for rrp in rp:
				if rrp != kk:
					a[i + 1] = rrp
					break
		else:
			a[i + 1] = rp[-1]
print(count)
print(''.join(a))


n = int(input())
s = input()
if n == 1:
	print(0)
	print(s)
	exit(0)
dp = [[10 ** 19, 10 ** 19, 10 ** 19] for _ in range(n)]
prev = [[-1] * 3 for _ in range(n)]
dct = {'R': 0, 'B': 1, 'G': 2}
back = {0: 'R', 1: 'B', 2: 'G'}
l = list(map(lambda x: dct[x], s))
dp[0][0] = 1
dp[0][1] = 1
dp[0][2] = 1
dp[0][l[0]] = 0
for i in range(1, len(s)):
	for j1 in range(0, 3):
		for j0 in range(0, 3):
			if j1 == j0:
				continue
			add = 0 if l[i] == j1 else 1
			if dp[i - 1][j0] + add < dp[i][j1]:
				dp[i][j1] = dp[i - 1][j0] + add
				prev[i][j1] = j0
tmp = [(dp[-1][0], 0), (dp[-1][1], 1), (dp[-1][2], 2)]
tmp.sort()
(min_number, nxt) = tmp[0]
result = [nxt]
for p in reversed(prev[1:]):
	nxt = p[nxt]
	result.append(nxt)
print(min_number)
print(''.join(list(map(lambda x: back[x], reversed(result)))))


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


n = int(input())
rgb = list(input())
newrgb = [rgb[0]]
colors = {'R', 'B', 'G'}
count = 0
for i in range(1, n - 1):
	if rgb[i] == newrgb[i - 1]:
		newcolors = colors - {rgb[i]} - {rgb[i + 1]}
		for e in newcolors:
			newrgb.append(e)
			break
		count += 1
	else:
		newrgb.append(rgb[i])
if n > 1 and rgb[-1] == newrgb[-1]:
	newcolor = colors - {rgb[-1]}
	for e in newcolor:
		newrgb.append(e)
		break
	count += 1
elif n > 1:
	newrgb.append(rgb[-1])
print(count)
print(''.join(newrgb))


n = int(input())
a = input()
b = ''
x = 0
m = n
w = ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']
for c in w:
	x = 0
	b = c * (n // 3) + c[:n % 3]
	for i in range(n):
		if b[i] != a[i]:
			x += 1
	if x <= m:
		m = x
		res = b
print(m)
print(res)


n = int(input())
s = input()
if n == 1:
	print(0)
	print(s)
	quit()

def diffrent(h1, h2):
	dct = {0: 'R', 1: 'G', 2: 'B'}
	dct2 = {'R': 0, 'G': 1, 'B': 2}
	if h1 == h2:
		k = (dct2[h1] + 1) % 3
		return dct[k]
	else:
		k = dct2[h1] + dct2[h2]
		if k == 1:
			return 'B'
		if k == 2:
			return 'G'
		if k == 3:
			return 'R'
stack = [s[0]]
x = 0
res = 0
for i in s[1:-1]:
	if i == stack[x]:
		res += 1
		j = diffrent(s[x + 2], stack[x])
	else:
		j = i
	x += 1
	stack.append(j)
if s[-1] == stack[-1]:
	res += 1
	j = diffrent(s[-1], stack[-1])
else:
	j = s[-1]
stack.append(j)
print(res)
print(''.join(stack))


def f(temp, t):
	r = 0
	for i in range(0, n, 3):
		for j in range(i, min(i + 3, n)):
			if t[j] != temp[j % 3]:
				r += 1
	ans.append((r, temp))
n = int(input())
t = input()
ans = []
for temp in ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']:
	f(temp, t)
ans.sort()
print(ans[0][0])
for i in range(0, n, 3):
	for j in range(i, min(i + 3, n)):
		print(ans[0][1][j % 3], end='')


def fun(st, n, s):
	st = st * (n // 3) + st[:n % 3]
	sc = 0
	for i in range(n):
		if st[i] != s[i]:
			sc += 1
	return (sc, st)
n = int(input())
s = input()
st = ['RGB', 'RBG', 'BGR', 'BRG', 'GBR', 'GRB']
m = 1000000000
mst = ''
for i in range(6):
	(sc, stri) = fun(st[i], n, s)
	if sc < m:
		m = sc
		mst = stri
print(m)
print(mst)


for t in range(1):
	n = int(input())
	string = list(input())
	cost = 0
	for i in range(1, n):
		color = ['R', 'G', 'B']
		prev = string[i - 1]
		curr = string[i]
		if curr == prev:
			color.remove(prev)
			if i < n - 1:
				next = string[i + 1]
				if curr != next:
					color.remove(next)
			string[i] = color[0]
			cost += 1
	print(cost)
	print(*string, sep='')


n = int(input())
g = input()
G = [0] * (n + 1)
R = [0] * (n + 1)
B = [0] * (n + 1)
for i in range(n):
	G[i] = min(R[i - 1] + (1 if g[i] != 'G' else 0), B[i - 1] + (1 if g[i] != 'G' else 0))
	R[i] = min(G[i - 1] + (1 if g[i] != 'R' else 0), B[i - 1] + (1 if g[i] != 'R' else 0))
	B[i] = min(G[i - 1] + (1 if g[i] != 'B' else 0), R[i - 1] + (1 if g[i] != 'B' else 0))
print(min(G[-2], R[-2], B[-2]))
current = ''
if G[-2] == min(G[-2], R[-2], B[-2]):
	current = 'G'
elif B[-2] == min(R[-2], B[-2]):
	current = 'B'
else:
	current = 'R'
A = []
for i in range(n - 1, -1, -1):
	A.append(current)
	if current == 'G':
		if R[i - 1] + (1 if g[i] != 'G' else 0) < B[i - 1] + (1 if g[i] != 'G' else 0):
			current = 'R'
		else:
			current = 'B'
	elif current == 'R':
		if G[i - 1] + (1 if g[i] != 'R' else 0) < B[i - 1] + (1 if g[i] != 'R' else 0):
			current = 'G'
		else:
			current = 'B'
	elif R[i - 1] + (1 if g[i] != 'B' else 0) < G[i - 1] + (1 if g[i] != 'B' else 0):
		current = 'R'
	else:
		current = 'G'
A.reverse()
print(''.join(A))


import sys
inn = lambda : input().strip()
n = int(inn())
lamp = inn()
if len(lamp) == 1:
	print(0)
	print(lamp)
	sys.exit()
if len(lamp) == 2:
	if lamp[0] == lamp[1]:
		print(1)
		secondLamp = tuple((a for a in ('R', 'G', 'B') if a != lamp[0]))[0]
		print(f'{lamp[0]}{secondLamp}')
		sys.exit()
	else:
		print(0)
		print(lamp)
		sys.exit()
rgbToNumber = {'R': 0, 'G': 1, 'B': 2}
numberToRgb = {0: 'R', 1: 'G', 2: 'B'}
lamp = [rgbToNumber[a] for a in lamp]
minRecolor = 987654321
recoloredLamp = ''
for rotation in [(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)]:
	recolor = 0
	for (i, a) in enumerate(lamp):
		if a != rotation[i % 3]:
			recolor += 1
	if recolor < minRecolor:
		minRecolor = recolor
		recoloredLamp = ''.join((numberToRgb[rotation[a % 3]] for a in range(n)))
print(minRecolor)
print(recoloredLamp)


def f(r, g, b):
	c = 0
	for (j, i) in enumerate(s):
		if i == 'R':
			if j % 3 != r:
				c += 1
		elif i == 'G':
			if j % 3 != g:
				c += 1
		elif i == 'B':
			if j % 3 != b:
				c += 1
	return c

def g(r, g, b):
	for i in range(n):
		if i % 3 == r:
			res[i] = 'R'
		elif i % 3 == g:
			res[i] = 'G'
		elif i % 3 == b:
			res[i] = 'B'
n = int(input())
s = [i for i in input()]
L = [0] * 6
L[0] = f(0, 1, 2)
L[1] = f(0, 2, 1)
L[2] = f(1, 0, 2)
L[3] = f(1, 2, 0)
L[4] = f(2, 0, 1)
L[5] = f(2, 1, 0)
mi = min(L)
i = 0
res = [0] * n
while i < 6:
	if L[i] == mi:
		break
	i += 1
if i == 0:
	g(0, 1, 2)
elif i == 1:
	g(0, 2, 1)
elif i == 2:
	g(1, 0, 2)
elif i == 3:
	g(1, 2, 0)
elif i == 4:
	g(2, 0, 1)
elif i == 5:
	g(2, 1, 0)
print(mi)
print(''.join(res))


num = int(input())
word = input()
R = [0, 0, 0]
G = [0, 0, 0]
B = [0, 0, 0]
for i in range(num):
	l = word[i]
	if l == 'R':
		R[i % 3] += 1
	elif l == 'G':
		G[i % 3] += 1
	else:
		B[i % 3] += 1
poss = [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 1, 0], [2, 0, 1]]
other = [[1, 2], [0, 2], [1, 0]]
dic = [R, G, B]
mn = float('inf')
mnp = None
for pos in poss:
	score = 0
	for i in range(3):
		score += dic[other[pos[i]][0]][i] + dic[other[pos[i]][1]][i]
	if score < mn:
		mn = score
		mnp = pos
q = ['R', 'G', 'B']
print(mn)
for i in range(num):
	print(q[mnp[i % 3]], end='')
print()


n = int(input())
I = input()
L = list(map(str, list(I)))
i = 0
D = []
while i < n:
	j = i
	while j + 1 < n and L[i] == L[j + 1]:
		j += 1
	if i != j:
		D.append([i, j])
	i = j + 1
c = 0
for a in D:
	if a[1] == n - 1:
		if L[a[0]] == 'G':
			b = a[0] + 1
			while b <= a[1]:
				L[b] = 'B'
				b += 2
				c += 1
		elif L[a[0]] == 'B':
			b = a[0] + 1
			while b <= a[1]:
				L[b] = 'R'
				b += 2
				c += 1
		elif L[a[0]] == 'R':
			b = a[0] + 1
			while b <= a[1]:
				L[b] = 'G'
				b += 2
				c += 1
	elif L[a[1] + 1] == 'R':
		if L[a[0]] == 'G':
			b = a[0] + 1
			while b <= a[1]:
				L[b] = 'B'
				b += 2
				c += 1
		elif L[a[0]] == 'B':
			b = a[0] + 1
			while b <= a[1]:
				L[b] = 'G'
				b += 2
				c += 1
		elif L[a[0]] == 'R':
			b = a[0] + 1
			while b <= a[1]:
				L[b] = 'G'
				b += 2
				c += 1
	elif L[a[1] + 1] == 'G':
		if L[a[0]] == 'G':
			b = a[0] + 1
			while b <= a[1]:
				L[b] = 'B'
				b += 2
				c += 1
		elif L[a[0]] == 'B':
			b = a[0] + 1
			while b <= a[1]:
				L[b] = 'R'
				b += 2
				c += 1
		elif L[a[0]] == 'R':
			b = a[0] + 1
			while b <= a[1]:
				L[b] = 'B'
				b += 2
				c += 1
	elif L[a[1] + 1] == 'B':
		if L[a[0]] == 'G':
			b = a[0] + 1
			while b <= a[1]:
				L[b] = 'R'
				b += 2
				c += 1
		elif L[a[0]] == 'B':
			b = a[0] + 1
			while b <= a[1]:
				L[b] = 'G'
				b += 2
				c += 1
		elif L[a[0]] == 'R':
			b = a[0] + 1
			while b <= a[1]:
				L[b] = 'G'
				b += 2
				c += 1
print(c)
print(''.join(L))


n = int(input())
s = list(input())
R1 = G1 = B1 = R2 = G2 = B2 = R3 = G3 = B3 = 0
for i in range(0, len(s), 3):
	if s[i] == 'R':
		R1 += 1
	elif s[i] == 'G':
		G1 += 1
	else:
		B1 += 1
for i in range(1, len(s), 3):
	if s[i] == 'R':
		R2 += 1
	elif s[i] == 'G':
		G2 += 1
	else:
		B2 += 1
for i in range(2, len(s), 3):
	if s[i] == 'R':
		R3 += 1
	elif s[i] == 'G':
		G3 += 1
	else:
		B3 += 1
R01 = G1 + B1
G01 = R1 + B1
B01 = R1 + G1
R02 = G2 + B2
G02 = R2 + B2
B02 = R2 + G2
R03 = G3 + B3
G03 = R3 + B3
B03 = R3 + G3
c1 = R01 + B02 + G03
c2 = R01 + G02 + B03
c3 = G01 + R02 + B03
c4 = G01 + B02 + R03
c5 = B01 + R02 + G03
c6 = B01 + G02 + R03
dic = {}
dic[c1] = ['R', 'B', 'G']
dic[c2] = ['R', 'G', 'B']
dic[c3] = ['G', 'R', 'B']
dic[c4] = ['G', 'B', 'R']
dic[c5] = ['B', 'R', 'G']
dic[c6] = ['B', 'G', 'R']
total = min(c1, c2, c3, c4, c5, c6)
tot = [0] * n
v1 = dic[total][0]
v2 = dic[total][1]
v3 = dic[total][2]
for i in range(0, len(s), 3):
	tot[i] = v1
for i in range(1, len(s), 3):
	tot[i] = v2
for i in range(2, len(s), 3):
	tot[i] = v3
totality = ''
for item in tot:
	totality += item
print(total)
print(totality)


n = int(input())
a = input()
str1 = ''
for i in range(n):
	if i % 3 == 0:
		str1 += 'R'
	elif i % 3 == 1:
		str1 += 'G'
	else:
		str1 += 'B'
str2 = ''
for i in range(n):
	if i % 3 == 0:
		str2 += 'R'
	elif i % 3 == 1:
		str2 += 'B'
	else:
		str2 += 'G'
str3 = ''
for i in range(n):
	if i % 3 == 0:
		str3 += 'B'
	elif i % 3 == 1:
		str3 += 'G'
	else:
		str3 += 'R'
str4 = ''
for i in range(n):
	if i % 3 == 0:
		str4 += 'B'
	elif i % 3 == 1:
		str4 += 'R'
	else:
		str4 += 'G'
str5 = ''
for i in range(n):
	if i % 3 == 0:
		str5 += 'G'
	elif i % 3 == 1:
		str5 += 'B'
	else:
		str5 += 'R'
str6 = ''
for i in range(n):
	if i % 3 == 0:
		str6 += 'G'
	elif i % 3 == 1:
		str6 += 'R'
	else:
		str6 += 'B'
lst = [str1, str2, str3, str4, str5, str6]
max_ = 10 ** 18
ans = 0
for i in range(6):
	gfhds = 0
	kak = lst[i]
	for j in range(n):
		if a[j] != kak[j]:
			gfhds += 1
	if max_ > gfhds:
		ans = i
		max_ = gfhds
print(max_)
print(lst[ans])


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()
arr = list(s)
c = 0
for i in range(1, n):
	if arr[i] == arr[i - 1]:
		c += 1
		if i + 1 < n:
			if arr[i] in ['R', 'G'] and arr[i + 1] in ['R', 'G']:
				arr[i] = 'B'
			elif arr[i] in ['R', 'B'] and arr[i + 1] in ['R', 'B']:
				arr[i] = 'G'
			elif arr[i] in ['B', 'G'] and arr[i + 1] in ['B', 'G']:
				arr[i] = 'R'
		elif arr[i] == 'R':
			arr[i] = 'G'
		elif arr[i] == 'G':
			arr[i] = 'B'
		else:
			arr[i] = 'R'
ans = ''.join(arr)
print(c)
print(ans)


a = int(input())
b = input()
c = a // 3
pos1 = 'RGB' * c
pos2 = 'RBG' * c
pos3 = 'GBR' * c
pos4 = 'GRB' * c
pos5 = 'BRG' * c
pos6 = 'BGR' * c
if a % 3 >= 1:
	pos1 += 'R'
	pos2 += 'R'
	pos3 += 'G'
	pos4 += 'G'
	pos5 += 'B'
	pos6 += 'B'
if a % 3 == 2:
	pos1 += 'G'
	pos2 += 'B'
	pos3 += 'B'
	pos4 += 'R'
	pos5 += 'R'
	pos6 += 'G'
(d1, d2, d3, d4, d5, d6) = (0, 0, 0, 0, 0, 0)
for i in range(a):
	if b[i] != pos1[i]:
		d1 += 1
for i in range(a):
	if b[i] != pos2[i]:
		d2 += 1
for i in range(a):
	if b[i] != pos3[i]:
		d3 += 1
for i in range(a):
	if b[i] != pos4[i]:
		d4 += 1
for i in range(a):
	if b[i] != pos5[i]:
		d5 += 1
for i in range(a):
	if b[i] != pos6[i]:
		d6 += 1
d7 = min(d1, d2, d3, d4, d5, d6)
print(d7)
if d1 == d7:
	print(pos1)
elif d2 == d7:
	print(pos2)
elif d3 == d7:
	print(pos3)
elif d4 == d7:
	print(pos4)
elif d5 == d7:
	print(pos5)
elif d6 == d7:
	print(pos6)


n = int(input())
s = input()
a = [['RGB', 0], ['RBG', 0], ['BRG', 0], ['BGR', 0], ['GRB', 0], ['GBR', 0]]
(_max, i_max) = (0, -1)
for i in range(0, n, 3):
	for j in range(6):
		for (c1, c2) in zip(s[i:i + 3], a[j][0]):
			if c1 == c2:
				a[j][1] += 1
				if a[j][1] > _max:
					(_max, i_max) = (a[j][1], j)
s_out = a[i_max][0] * (n // 3) + a[i_max][0][:n % 3]
c = 0
for (c1, c2) in zip(s, s_out):
	if c1 != c2:
		c += 1
print(c)
print(s_out)


ss = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
n = int(input())
mini = 99999999999
ans = ''
st = input()
if n == 1:
	ans = st
	mini = 0
elif n == 2:
	if st == 'RR':
		mini = 1
		ans = 'RG'
	if st == 'GG':
		mini = 1
		ans = 'GR'
	if st == 'BB':
		mini = 1
		ans = 'BR'
	else:
		ans = st
		mini = 0
elif n % 3 == 0:
	kk = n // 3
	for i in range(6):
		ss[i] *= kk
	for i in range(6):
		cnt = 0
		for j in range(n):
			if ss[i][j] != st[j]:
				cnt += 1
		if cnt < mini:
			mini = cnt
			ans = ss[i]
elif n % 3 == 1:
	kk = n // 3
	for i in range(6):
		ss[i] *= kk
		ss[i] += ss[i][0]
	for i in range(6):
		cnt = 0
		for j in range(n):
			if ss[i][j] != st[j]:
				cnt += 1
		if cnt < mini:
			mini = cnt
			ans = ss[i]
elif n % 3 == 2:
	kk = n // 3
	for i in range(6):
		ss[i] *= kk
		ss[i] += ss[i][0]
		ss[i] += ss[i][1]
	for i in range(6):
		cnt = 0
		for j in range(n):
			if ss[i][j] != st[j]:
				cnt += 1
		if cnt < mini:
			mini = cnt
			ans = ss[i]
print(mini)
print(ans)


n = int(input())
s = input()
a = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
a1 = []
res = []
for i in a:
	x = i * (n // 3 + 1)
	a1.append(x[:n])
for i in a1:
	v = 0
	for j in range(n):
		if s[j] != i[j]:
			v += 1
	res.append(v)
print(min(res))
print(a1[res.index(min(res))])


n = int(input())
s = [i for i in input()]
T = ['R', 'G', 'B']
add = 0
for i in range(n - 1):
	if s[i] == s[i + 1]:
		add += 1
		if i + 2 < n:
			for j in T:
				if j != s[i] and j != s[i + 2]:
					s[i + 1] = j
					break
		else:
			for j in T:
				if j != s[i]:
					s[i + 1] = j
					break
print(add)
print(''.join(s))


n = int(input())
seq = input()
ans = 0
ln = ''
skip = False
for i in range(len(seq)):
	s = seq[i]
	if skip:
		skip = False
		continue
	try:
		if s == seq[i + 1]:
			ans += 1
			skip = True
			try:
				if s == 'G':
					if seq[i + 2] == 'R':
						ln += 'GB'
					else:
						ln += 'GR'
				elif s == 'R':
					if seq[i + 2] == 'B':
						ln += 'RG'
					else:
						ln += 'RB'
				elif s == 'B':
					if seq[i + 2] == 'R':
						ln += 'BG'
					else:
						ln += 'BR'
			except IndexError:
				if s == 'G':
					if seq[i + 1] == 'R':
						ln += 'GB'
					else:
						ln += 'GR'
				elif s == 'R':
					if seq[i + 1] == 'B':
						ln += 'RG'
					else:
						ln += 'RB'
				elif s == 'B':
					if seq[i + 1] == 'R':
						ln += 'BG'
					else:
						ln += 'BR'
		else:
			ln += s
	except IndexError:
		ln += s
print(ans)
print(ln)


n = int(input())
s = input()
encoding_dict = {'R': 0, 'G': 1, 'B': 2}
s = list(map(lambda c: encoding_dict[c], s))
MAX_VALUE = 200000
t = {c: [0] * (n + 1) for c in range(3)}
l = {c: [0] * (n + 1) for c in range(3)}
for i in range(1, n + 1):
	for current_ch in range(3):
		min_v = MAX_VALUE
		min_c = None
		for previous_ch in range(3):
			if current_ch == previous_ch:
				continue
			if min_v > t[previous_ch][i - 1]:
				(min_v, min_c) = (t[previous_ch][i - 1], previous_ch)
		(t[current_ch][i], l[current_ch][i]) = (min_v, min_c)
		if s[i - 1] != current_ch:
			t[current_ch][i] += 1
(min_v, min_c) = (MAX_VALUE, None)
for c in range(3):
	if min_v > t[c][n]:
		(min_v, min_c) = (t[c][n], c)
print(min_v)
r = []
for i in range(n, 0, -1):
	r.append(min_c)
	min_c = l[min_c][i]
encoding_dict = {0: 'R', 1: 'G', 2: 'B'}
print(''.join(map(lambda c: encoding_dict[c], r[::-1])))


n = int(input())
s = list(input())
ans = 0
g = {'BG': 'R', 'GB': 'R', 'GR': 'B', 'RG': 'B', 'BR': 'G', 'RB': 'G', 'GG': 'R', 'BB': 'R', 'RR': 'G'}
for i in range(n - 2):
	if s[i] == s[i + 1]:
		s[i + 1] = g[s[i] + s[i + 2]]
		ans += 1
if n > 1 and s[-2] == s[-1]:
	s[-1] = g[s[-1] + 'G']
	ans += 1
print(ans)
print(''.join(s))


n = int(input())
s = list(input())
f_R = 0
s_G = 0
t_B = 0
s_B = 0
t_G = 0
f_B = 0
s_R = 0
t_G = 0
s_G = 0
t_R = 0
f_G = 0
s_R = 0
t_B = 0
s_B = 0
t_R = 0
total_changes = 200000
closest_string = ''
t = s.copy()
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'R':
			f_R += 1
			s[i] = 'R'
	elif i % 3 == 1:
		if s[i] != 'G':
			s_G += 1
			s[i] = 'G'
	elif s[i] != 'B':
		t_B += 1
		s[i] = 'B'
if f_R + s_G + t_B < total_changes:
	total_changes = f_R + s_G + t_B
	closest_string = s
f_R = 0
s_G = 0
t_B = 0
s = t.copy()
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'R':
			f_R += 1
			s[i] = 'R'
	elif i % 3 == 1:
		if s[i] != 'B':
			s_B += 1
			s[i] = 'B'
	elif s[i] != 'G':
		t_G += 1
		s[i] = 'G'
if f_R + s_B + t_G < total_changes:
	total_changes = f_R + s_B + t_G
	closest_string = s
f_R = 0
s_B = 0
t_G = 0
s = t.copy()
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'B':
			f_B += 1
			s[i] = 'B'
	elif i % 3 == 1:
		if s[i] != 'R':
			s_R += 1
			s[i] = 'R'
	elif s[i] != 'G':
		t_G += 1
		s[i] = 'G'
if f_B + s_R + t_G < total_changes:
	total_changes = f_B + s_R + t_G
	closest_string = s
f_B = 0
s_R = 0
t_G = 0
s = t.copy()
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'B':
			f_B += 1
			s[i] = 'B'
	elif i % 3 == 1:
		if s[i] != 'G':
			s_G += 1
			s[i] = 'G'
	elif s[i] != 'R':
		t_R += 1
		s[i] = 'R'
if f_B + s_G + t_R < total_changes:
	total_changes = f_B + s_G + t_R
	closest_string = s
f_B = 0
s_G = 0
t_R = 0
s = t.copy()
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'G':
			f_G += 1
			s[i] = 'G'
	elif i % 3 == 1:
		if s[i] != 'R':
			s_R += 1
			s[i] = 'R'
	elif s[i] != 'B':
		t_B += 1
		s[i] = 'B'
if f_G + s_R + t_B < total_changes:
	total_changes = f_G + s_R + t_B
	closest_string = s
f_G = 0
s_R = 0
t_B = 0
s = t.copy()
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'G':
			f_G += 1
			s[i] = 'G'
	elif i % 3 == 1:
		if s[i] != 'B':
			s_B += 1
			s[i] = 'B'
	elif s[i] != 'R':
		t_R += 1
		s[i] = 'R'
if f_G + s_B + t_R < total_changes:
	total_changes = f_G + s_B + t_R
	closest_string = s
f_G = 0
s_B = 0
t_R = 0
s = t.copy()
print(total_changes)
print(''.join(map(str, closest_string)))


n = int(input())
lamps = input()
if n == 1:
	print(0)
	exit(print(lamps))
if n == 2:
	if lamps[0] != lamps[1]:
		print(0)
		exit(print(lamps))
	else:
		print(1)
		if lamps[0] == 'R':
			exit(print('RG'))
		elif lamps[0] == 'G':
			exit(print('GR'))
		else:
			exit(print('BR'))
first = [0, 0, 0]
second = [0, 0, 0]
third = [0, 0, 0]
for i in range(n // 3):
	if lamps[3 * i] == 'R':
		first[0] += 1
	elif lamps[3 * i] == 'G':
		first[1] += 1
	else:
		first[2] += 1
	if lamps[3 * i + 1] == 'R':
		second[0] += 1
	elif lamps[3 * i + 1] == 'G':
		second[1] += 1
	else:
		second[2] += 1
	if lamps[3 * i + 2] == 'R':
		third[0] += 1
	elif lamps[3 * i + 2] == 'G':
		third[1] += 1
	else:
		third[2] += 1
ost = n % 3
if ost == 1:
	if lamps[n - 1] == 'R':
		first[0] += 1
	elif lamps[n - 1] == 'G':
		first[1] += 1
	else:
		first[2] += 1
if ost == 2:
	if lamps[n - 2] == 'R':
		first[0] += 1
	elif lamps[n - 2] == 'G':
		first[1] += 1
	else:
		first[2] += 1
	if lamps[n - 1] == 'R':
		second[0] += 1
	elif lamps[n - 1] == 'G':
		second[1] += 1
	else:
		second[2] += 1
firstn = [0, 0, 0]
secondn = [0, 0, 0]
thirdn = [0, 0, 0]
firstn[0] = first[1] + first[2]
firstn[1] = first[0] + first[2]
firstn[2] = first[0] + first[1]
secondn[0] = second[1] + second[2]
secondn[1] = second[0] + second[2]
secondn[2] = second[0] + second[1]
thirdn[0] = third[1] + third[2]
thirdn[1] = third[0] + third[2]
thirdn[2] = third[0] + third[1]
min = n
str = 'BBB'
if firstn[0] + secondn[1] + thirdn[2] < min:
	min = firstn[0] + secondn[1] + thirdn[2]
	str = 'RGB'
if firstn[0] + secondn[2] + thirdn[1] < min:
	min = firstn[0] + secondn[2] + thirdn[1]
	str = 'RBG'
if firstn[1] + secondn[0] + thirdn[2] < min:
	min = firstn[1] + secondn[0] + thirdn[2]
	str = 'GRB'
if firstn[1] + secondn[2] + thirdn[0] < min:
	min = firstn[1] + secondn[2] + thirdn[0]
	str = 'GBR'
if firstn[2] + secondn[0] + thirdn[1] < min:
	min = firstn[2] + secondn[0] + thirdn[1]
	str = 'BRG'
if firstn[2] + secondn[1] + thirdn[0] < min:
	min = firstn[2] + secondn[1] + thirdn[0]
	str = 'BGR'
print(min)
str = str * (n // 3) + str[:ost]
print(str)


from collections import Counter
n = int(input())
lampade = input()
opzioni = []
str1 = 'RGB' * (n // 3 + 1)
str2 = 'RBG' * (n // 3 + 1)
str3 = 'GRB' * (n // 3 + 1)
str4 = 'GBR' * (n // 3 + 1)
str5 = 'BGR' * (n // 3 + 1)
str6 = 'BRG' * (n // 3 + 1)
opzioni.append(str1)
opzioni.append(str2)
opzioni.append(str3)
opzioni.append(str4)
opzioni.append(str5)
opzioni.append(str6)
contatore = []
for i in range(6):
	cont = 0
	for j in range(n):
		if opzioni[i][j] == lampade[j]:
			pass
		else:
			cont = cont + 1
	contatore.append(cont)
coso = contatore.index(min(contatore))
scelta = opzioni[coso]
print(min(contatore))
print(scelta[:n])


N = int(input())
s = input()
a = 'RGB'
b = 'RBG'
c = 'BGR'
d = 'BRG'
e = 'GBR'
f = 'GRB'
myarr = [a, b, c, d, e, f]
count = [0, 0, 0, 0, 0, 0]
k = 0
for i in range(N):
	k = i % 3
	if a[k] != s[i]:
		count[0] += 1
	if b[k] != s[i]:
		count[1] += 1
	if c[k] != s[i]:
		count[2] += 1
	if d[k] != s[i]:
		count[3] += 1
	if e[k] != s[i]:
		count[4] += 1
	if f[k] != s[i]:
		count[5] += 1
r = count.index(min(count))
L = myarr[r]
print(min(count))
for i in range(N):
	print(L[i % 3], end='')
print()


def editor():
	import sys
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	n = int(input())
	s = input()
	times = n // 3
	times += 1
	minrec = 200000.0 + 1
	length = len(s)
	combi = ['RGB' * times, 'RBG' * times, 'BGR' * times, 'BRG' * times, 'GRB' * times, 'GBR' * times]
	for j in range(len(combi)):
		recolour = 0
		for i in range(length):
			recolour += 0 if s[i] == combi[j][i] else 1
		if minrec > recolour:
			minrec = recolour
			resstring = combi[j][:length]
	print(minrec)
	print(resstring)
tc = 1
for t in range(tc):
	solve()


def diff(t, s, n):
	num_paint = 0
	for i in range(n):
		if t[i] != s[i]:
			num_paint += 1
	return num_paint

def build_girland(pattern, n):
	(d, m) = divmod(n, 3)
	return pattern * d + ('' if m == 0 else pattern[:m])
n = int(input())
s = input()
patterns = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
min_paint = n + 1
good_girland = ''
for pattern in patterns:
	true_girland = build_girland(pattern, n)
	num_paint = diff(true_girland, s, n)
	if num_paint < min_paint:
		min_paint = num_paint
		good_girland = true_girland
print(min_paint)
print(good_girland)


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]))


n = int(input())
s = input()
s = list(s)
c = 'RGB'
c = list(c)
count = 0
for i in range(1, len(s)):
	c = 'RGB'
	c = list(c)
	if s[i] == s[i - 1]:
		count += 1
		if i == n - 1:
			c.remove(s[i - 1])
			s[i] = c[0]
		elif s[i + 1] != s[i - 1]:
			c.remove(s[i - 1])
			c.remove(s[i + 1])
			s[i] = c[0]
		else:
			c.remove(s[i])
			s[i] = c[0]
print(count)
for i in s:
	print(i, end='')


n = int(input())
s = input()
a = ['RGB', 'RBG', 'BGR', 'BRG', 'GBR', 'GRB']
ans = 10 ** 7
ans2 = ''
youso = 0
b = ''
for i in a:
	cnt = 0
	b = ''
	for j in range(n):
		x = j % 3
		if i[x] != s[j]:
			cnt += 1
		b += i[x]
	if cnt < ans:
		ans = cnt
		ans2 = b
print(ans)
print(ans2)


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	n = I()
	a = input().strip()
	a = list(a)
	if n == 1:
		print(0)
		print(a[0])
		return
	c = 0
	for i in range(n - 1):
		if a[i] == a[i + 1]:
			c += 1
			if a[(i + 2) % n] != 'B' and a[i] != 'B':
				a[i + 1] = 'B'
			elif a[(i + 2) % n] != 'G' and a[i] != 'G':
				a[i + 1] = 'G'
			else:
				a[i + 1] = 'R'
	print(c)
	print(''.join(map(str, a)))
for _ in range(1):
	case()


import math
n = int(input())
s = list(input())
pat = ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']
ans = [0 for i in range(6)]
pos = 0
for i in range(math.ceil(n / 3)):
	for j in range(3):
		if j + pos >= n:
			break
		for p in range(6):
			if pat[p][j] != s[pos + j]:
				ans[p] += 1
	pos += 3
m = min(ans)
fin = ''
for i in range(6):
	if ans[i] == m:
		for j in range(math.ceil(n / 3)):
			fin += pat[i][:min(n, 3)]
			n = max(n - 3, 0)
		break
print(m)
print(fin)


def solve(s):
	if len(s) == 1:
		return (0, list(s))
	if len(s) == 2:
		if s[0] == s[1]:
			if s[0] == 'R':
				d = 'G'
			elif s[0] == 'G':
				d = 'R'
			else:
				d = 'R'
			return (1, [s[0], d])
		return (0, list(s))
	cost = {}
	rot = {}
	for a in ('R', 'G', 'B'):
		for b in ('R', 'G', 'B'):
			for c in ('R', 'G', 'B'):
				if a != b and b != c and (a != c):
					cost[a, b, c] = 0
					rot[a, b, c] = 0
	for (i, c) in enumerate(s[:s_len]):
		if i < 3:
			for k in cost:
				if k[i] != c:
					cost[k] += 1
		else:
			new_cost = {}
			new_rot = {}
			for (x, y, z) in cost:
				new_cost[y, z, x] = cost[x, y, z] + (1 if x != c else 0)
				new_rot[y, z, x] = rot[x, y, z] + 1
			cost = new_cost
			rot = new_rot
	min_cost = float('inf')
	min_key = None
	for (key, cost) in cost.items():
		if not min_key or cost < min_cost:
			min_cost = cost
			min_key = key
	(a, b, c) = min_key
	if rot[min_key] % 3 == 1:
		(b, c, a) = (a, b, c)
	elif rot[min_key] % 3 == 2:
		(b, c, a) = (a, b, c)
		(b, c, a) = (a, b, c)
	min_seq = [a, b, c] * (len(s) // 3 + 1)
	return (min_cost, min_seq[:len(s)])
import sys
(n, s) = (sys.stdin.readline(), sys.stdin.readline())
s_len = len(s)
if s[s_len - 1] == '\n':
	s_len -= 1
(cost, seq) = solve(s[:s_len])
print(cost)
print(''.join(seq))


n = int(input())
s = input()
s = list(s)
if len(s) <= 2 and len(set(s)) > 1:
	print(0)
	print(''.join(s))
elif len(s) == 2:
	print(1)
	bam = 'RGB'
	print(s[0] + bam[(bam.index(s[0]) + 1) % 3])
else:
	perekras = 0
	for t in range(1, len(s) - 1):
		if s[t - 1] == s[t] and s[t] == s[t + 1]:
			z = {'R', 'G', 'B'}
			perekras += 1
			z.discard(s[t - 1])
			z.discard(s[t + 1])
			s[t] = z.pop()
	for t in range(1, len(s) - 1):
		if s[t - 1] == s[t] or s[t] == s[t + 1]:
			z = {'R', 'G', 'B'}
			perekras += 1
			z.discard(s[t - 1])
			z.discard(s[t + 1])
			s[t] = z.pop()
	print(perekras)
	print(''.join(s))


import math as m
n = int(input())
lamps = list(input())
div = n // 3
rem = n - div * 3
list1 = [list('RGB'), list('RBG'), list('GBR'), list('GRB'), list('BGR'), list('BRG')]
addition = []
count = 0
min = m.inf
for l in list1:
	count = 0
	for (i, c) in enumerate(lamps):
		if i % 3 == 0:
			if c != l[0]:
				count += 1
		elif i % 3 == 1:
			if c != l[1]:
				count += 1
		elif c != l[2]:
			count += 1
	if count < min:
		min = count
		gar = l
add = ''
if rem == 1:
	add = gar[0]
elif rem == 2:
	add = gar[0] + gar[1]
ans = ''.join(gar) * div + add
print(min)
print(ans)


import sys, heapq
input = sys.stdin.readline
n = int(input())
s = list(input())
s.pop()
dp0 = [0] * n
dp1 = [1] * n
for i in range(1, n):
	if s[i] == s[i - 1]:
		dp0[i] = dp1[i - 1]
		dp1[i] = min(dp0[i - 1], dp1[i - 1]) + 1
	else:
		dp0[i] = min(dp0[i - 1], dp1[i - 1])
		dp1[i] = min(dp0[i - 1], dp1[i - 1]) + 1
print(min(dp0[-1], dp1[-1]))
res = [''] * n
if dp0[-1] > dp1[-1]:
	if s[-1] == 'R':
		res[-1] = 'G'
	else:
		res[-1] = 'R'
else:
	res[-1] = s[-1]

def dis(x, y):
	if x != 'R' and y != 'R':
		return 'R'
	if x != 'G' and y != 'G':
		return 'G'
	if x != 'B' and y != 'B':
		return 'B'
for i in range(n - 2, -1, -1):
	if s[i] == res[i + 1]:
		if i == 0 and s[i] == 'G':
			res[i] = 'R'
		elif i == 0:
			res[i] = 'G'
		else:
			res[i] = dis(res[i + 1], s[i - 1])
	else:
		res[i] = s[i]
print(''.join(res))


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(n,) = I()
l = list(input())
an = 0
for i in range(n - 1):
	if l[i] == l[i + 1]:
		an += 1
		if i < n - 2:
			if l[i] == l[i + 2]:
				l[i + 1] = 'G' if l[i] in ['R', 'B'] else 'R'
			else:
				l[i + 1] = 'G' if l[i] + l[i + 2] in ['RB', 'BR'] else 'R' if l[i] + l[i + 2] in ['GB', 'BG'] else 'B'
		else:
			l[i + 1] = 'G' if l[i] in ['R', 'B'] else 'R'
print(an)
print(''.join(l))


n = int(input())
p = 0
g = list(str(input()))
for i in range(1, n):
	if g[i] == g[i - 1]:
		p += 1
		arr = ['R', 'G', 'B']
		if arr.count(g[i - 1]) != 0:
			del arr[arr.index(g[i])]
		if i != n - 1:
			if arr.count(g[i + 1]) != 0:
				del arr[arr.index(g[i + 1])]
		g[i] = arr[0]
print(p)
print(''.join(g))


from itertools import *
from math import *
(n, s) = (int(input()), input())
(per, st, ans, out) = (list(permutations([0, 1, 2])), 'RGB', '', inf)
for j in per:
	(count, st1, ans1) = (0, st[j[0]] + st[j[1]] + st[j[2]], '')
	for i in range(n):
		if s[i] != st1[i % 3]:
			ans1 += st1[i % 3]
			count += 1
		else:
			ans1 += s[i]
	if count < out:
		out = count
		ans = ans1
print(out, ans, sep='\n')


import sys
inf = float('inf')
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def main():
	n = int(input())
	s = input().strip()
	from math import ceil
	x = ceil(n / 3)
	r1 = [['R'], ['G'], ['B']] * x
	r2 = [['R'], ['B'], ['G']] * x
	g1 = [['G'], ['B'], ['R']] * x
	g2 = [['G'], ['R'], ['B']] * x
	b1 = [['B'], ['G'], ['R']] * x
	b2 = [['B'], ['R'], ['G']] * x
	mn = inf
	count = 0
	for i in range(n):
		if s[i] != r1[i][0]:
			count += 1
	if mn > count:
		mn = count
		flag = 1
	if mn == 0:
		print(0)
		print(s)
		return
	count = 0
	for i in range(n):
		if s[i] != r2[i][0]:
			count += 1
	if mn > count:
		mn = count
		flag = 2
	if mn == 0:
		print(0)
		print(s)
		return
	count = 0
	for i in range(n):
		if s[i] != g1[i][0]:
			count += 1
	if mn > count:
		mn = count
		flag = 3
	if mn == 0:
		print(0)
		print(s)
		return
	count = 0
	for i in range(n):
		if s[i] != g2[i][0]:
			count += 1
	if mn > count:
		mn = count
		flag = 4
	if mn == 0:
		print(0)
		print(s)
		return
	count = 0
	for i in range(n):
		if s[i] != b1[i][0]:
			count += 1
	if mn > count:
		mn = count
		flag = 5
	if mn == 0:
		print(0)
		print(s)
		return
	count = 0
	for i in range(n):
		if s[i] != b2[i][0]:
			count += 1
	if mn > count:
		mn = count
		flag = 6
	if mn == 0:
		print(0)
		print(s)
		return
	print(mn)
	if flag == 1:
		for i in range(n):
			print(r1[i][0], end='')
		print()
		return
	if flag == 2:
		for i in range(n):
			print(r2[i][0], end='')
		print()
		return
	if flag == 3:
		for i in range(n):
			print(g1[i][0], end='')
		print()
		return
	if flag == 4:
		for i in range(n):
			print(g2[i][0], end='')
		print()
		return
	if flag == 5:
		for i in range(n):
			print(b1[i][0], end='')
		print()
		return
	if flag == 6:
		for i in range(n):
			print(b2[i][0], end='')
		print()
		return
main()


n = int(input())
s = list(input())
cnt = 0
a = ['R', 'G', 'B']
if n > 1:
	for i in range(1, n - 1):
		if s[i] == s[i - 1]:
			cnt += 1
			for j in a:
				if j not in [s[i - 1], s[i + 1]]:
					s[i] = j
					break
	if s[n - 1] == s[n - 2]:
		cnt += 1
		for j in a:
			if j not in [s[n - 2]]:
				s[n - 1] = j
				break
	print(cnt)
	print(''.join(s))
else:
	print(0)
	print(''.join(s))


from math import inf
int(input())
s = input()
l = ['RGB', 'RBG', 'GBR', 'GRB', 'BRG', 'BGR']
l = [[(x * len(s))[:len(s)], inf] for x in l]
for j in range(len(l)):
	total = 0
	for i in range(len(s)):
		if s[i] != l[j][0][i]:
			total += 1
	l[j][1] = total
l = sorted(l, key=lambda x: x[1])
print(l[0][1])
print(l[0][0])


n = int(input())
s = input()
ex = s
cn = 1000000000
ans = ''
c = 0
s = ex
s = list(s)
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'R':
			s[i] = 'R'
			c += 1
	if i % 3 == 1:
		if s[i] != 'G':
			s[i] = 'G'
			c += 1
	if i % 3 == 2:
		if s[i] != 'B':
			s[i] = 'B'
			c += 1
if c < cn:
	cn = c
	ans = s
s = ex
s = list(s)
c = 0
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'R':
			s[i] = 'R'
			c += 1
	elif i % 3 == 1:
		if s[i] != 'B':
			s[i] = 'B'
			c += 1
	elif i % 3 == 2:
		if s[i] != 'G':
			s[i] = 'G'
			c += 1
if c < cn:
	cn = c
	ans = s
c = 0
s = ex
s = list(s)
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'B':
			s[i] = 'B'
			c += 1
	elif i % 3 == 1:
		if s[i] != 'G':
			s[i] = 'G'
			c += 1
	elif i % 3 == 2:
		if s[i] != 'R':
			s[i] = 'R'
			c += 1
if c < cn:
	cn = c
	ans = s
c = 0
s = ex
s = list(s)
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'B':
			s[i] = 'B'
			c += 1
	elif i % 3 == 1:
		if s[i] != 'R':
			s[i] = 'R'
			c += 1
	elif i % 3 == 2:
		if s[i] != 'G':
			s[i] = 'G'
			c += 1
if c < cn:
	cn = c
	ans = s
c = 0
s = ex
s = list(s)
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'G':
			s[i] = 'G'
			c += 1
	elif i % 3 == 1:
		if s[i] != 'B':
			s[i] = 'B'
			c += 1
	elif i % 3 == 2:
		if s[i] != 'R':
			s[i] = 'R'
			c += 1
if c < cn:
	cn = c
	ans = s
c = 0
s = ex
s = list(s)
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'G':
			s[i] = 'G'
			c += 1
	elif i % 3 == 1:
		if s[i] != 'R':
			s[i] = 'R'
			c += 1
	elif i % 3 == 2:
		if s[i] != 'B':
			s[i] = 'B'
			c += 1
if c < cn:
	cn = c
	ans = s
st = ''
for i in range(n):
	st += ans[i]
print(cn)
print(st)


input()
s = input()
m = len(s)
v = 0
variants = ['RGB', 'RBG', 'BGR', 'BRG', 'GBR', 'GRB']
for i in variants:
	cnt = 0
	for j in range(len(s)):
		if s[j] != i[j % 3]:
			cnt += 1
	if m > cnt:
		m = cnt
		v = i
print(m)
print(v * (len(s) // 3) + v[:len(s) % 3])


n = int(input())
s = input()
x = ['BGR', 'BRG', 'GBR', 'GRB', 'RGB', 'RBG']
ans = n + n
xi = -1
for i in range(6):
	loc = 0
	for j in range(n):
		if s[j] != x[i][j % 3]:
			loc += 1
	if ans > loc:
		ans = loc
		xi = i
print(ans)
print(x[xi] * (n // 3) + x[xi][:n % 3])


from math import ceil
n = int(input())
gar = input()
gar2 = gar + 'k' * (3 * ceil(n / 3) - n)
a = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
b = [0] * 6
for i in range(0, n, 3):
	for j in range(6):
		for k in range(0, 3):
			if gar2[i + k] == a[j][k]:
				continue
			elif gar2[i + k] == 'k':
				break
			else:
				b[j] += 1
ind = b.index(min(b))
print(b[ind])
print(a[ind] * (n // 3) + a[ind][:n - 3 * (n // 3)])


def hamming(A, B):
	ans = 0
	for a in range(len(A)):
		if A[a] != B[a]:
			ans += 1
	return ans
n = int(input())
I = input()
L = list(map(str, list(I)))
if n == 1:
	print(0)
	print(''.join(L))
else:
	a = hamming(I, ('GRB' * (n // 3 + 1))[:n])
	b = hamming(I, ('GBR' * (n // 3 + 1))[:n])
	c = hamming(I, ('RBG' * (n // 3 + 1))[:n])
	d = hamming(I, ('RGB' * (n // 3 + 1))[:n])
	e = hamming(I, ('BRG' * (n // 3 + 1))[:n])
	f = hamming(I, ('BGR' * (n // 3 + 1))[:n])
	ans = min([a, b, c, d, e, f])
	if ans == a:
		print(a)
		print(('GRB' * (n // 3 + 1))[:n])
	elif ans == b:
		print(b)
		print(('GBR' * (n // 3 + 1))[:n])
	elif ans == c:
		print(c)
		print(('RBG' * (n // 3 + 1))[:n])
	elif ans == d:
		print(d)
		print(('RGB' * (n // 3 + 1))[:n])
	elif ans == e:
		print(e)
		print(('BRG' * (n // 3 + 1))[:n])
	elif ans == f:
		print(f)
		print(('BGR' * (n // 3 + 1))[:n])


import sys
n = int(sys.stdin.readline())
s = [tmp for tmp in sys.stdin.readline().rstrip()]
ll = ['R', 'G', 'B']
dl = {'R': 0, 'G': 1, 'B': 2}
f = [0] * 9
for sh in range(3):
	for i in range(sh, n, 3):
		f[sh * 3 + dl[s[i]]] += 1
lseq = []
minch = n + 1
for l1 in range(3):
	for l2 in range(3):
		if l2 == l1:
			continue
		for l3 in range(3):
			if l3 == l1 or l3 == l2:
				continue
			tch = sum(f[:3]) - f[l1] + sum(f[3:6]) - f[3 + l2] + sum(f[6:9]) - f[6 + l3]
			if tch < minch:
				minch = tch
				lseq = [ll[l1], ll[l2], ll[l3]]
s = (lseq * (n // 3 + 1))[:n]
print(minch)
print(*s, sep='')


n = int(input())
r = []
g = []
b = []
a = list(input())
r2 = []
b2 = []
g2 = []
for i in range(400005 // 3 + 10):
	r.append('R')
	r.append('G')
	r.append('B')
	r2.append('R')
	r2.append('B')
	r2.append('G')
g = r[1:]
b = r[2:]
r = r[:n]
g = g[:n]
b = b[:n]
b2 = r2[1:]
g2 = r2[2:]
r2 = r2[:n]
g2 = g2[:n]
b2 = b2[:n]
cr = 0
cg = 0
cb = 0
cr2 = 0
cg2 = 0
cb2 = 0
for i in range(n):
	if a[i] != r[i]:
		cr += 1
	if a[i] != g[i]:
		cg += 1
	if a[i] != b[i]:
		cb += 1
	if a[i] != r2[i]:
		cr2 += 1
	if a[i] != b2[i]:
		cb2 += 1
	if a[i] != g2[i]:
		cg2 += 1
mini = min(cr, cb, cg, cr2, cg2, cb2)
print(mini)
if mini == cr:
	print(''.join(r))
elif mini == cg:
	print(''.join(g))
elif mini == cb:
	print(''.join(b))
elif mini == cr2:
	print(''.join(r2))
elif mini == cg2:
	print(''.join(g2))
else:
	print(''.join(b2))


n = int(input())
s = input()
cases = ('RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR')
out = []
for case in cases:
	tmp = 0
	for (x, y) in zip(s, case * n):
		if x != y:
			tmp += 1
	out.append((tmp, case))
(r, ans) = min(out)
print(r)
print((ans * n)[:n])


import collections
import itertools
(n, s) = (int(input()), input())
c = []
for i in range(3):
	t = collections.Counter(s[i::3])
	c.append({color: t[color] for color in 'RGB'})
	c[i]['ALL'] = sum(t.values())
m = min([(sum([c[i]['ALL'] - c[i][colors[i]] for i in range(3)]), colors) for colors in itertools.permutations('RGB', 3)], key=lambda x: x[0])
print(m[0])
print(''.join((m[1] * (n // 3 + 1))[:n]))


from collections import Counter
from itertools import permutations
from math import inf
n = int(input())
s = input()
(c1, c2, c3) = (Counter(s[0::3]), Counter(s[1::3]), Counter(s[2::3]))
t1 = n // 3
(t2, t3) = (t1, t1)
if n % 3 > 0:
	t1 += 1
if n % 3 > 1:
	t2 += 1
best = None
b_score = inf
for perm in permutations(['R', 'G', 'B']):
	score = 0
	score += t1 - c1[perm[0]]
	score += t2 - c2[perm[1]]
	score += t3 - c3[perm[2]]
	if score < b_score:
		b_score = score
		best = perm
print(b_score)
print(''.join(best * t1)[:n])


n = int(input())
li = [i for i in input()]
l = ['RGB' * (n // 3 + 3), 'BRG' * (n // 3 + 3), 'GBR' * (n // 3 + 3), 'RBG' * (n // 3 + 3), 'BGR' * (n // 3 + 3), 'GRB' * (n // 3 + 3)]
result = t = n
k = lis = 0
for j in l:
	result = 0
	for i in range(n):
		if li[i] != j[i:i + 1]:
			result += 1
	if result < t:
		t = result
		lis = k
	k += 1
print(t)
print(l[lis][:n])


n = int(input())
a = []
b = []
c = []
d = []
e = []
f = []
for i in range(n):
	if i % 3 == 0:
		a.append('R')
		b.append('G')
		c.append('B')
		d.append('R')
		e.append('G')
		f.append('B')
	elif i % 3 == 1:
		a.append('G')
		b.append('B')
		c.append('R')
		d.append('B')
		e.append('R')
		f.append('G')
	else:
		a.append('B')
		b.append('R')
		c.append('G')
		d.append('G')
		e.append('B')
		f.append('R')
li = list(input())
cnt1 = 0
cnt2 = 0
cnt3 = 0
cnt4 = 0
cnt5 = 0
cnt6 = 0
for i in range(len(li)):
	if li[i] != a[i]:
		cnt1 += 1
	if li[i] != b[i]:
		cnt2 += 1
	if li[i] != c[i]:
		cnt3 += 1
	if li[i] != d[i]:
		cnt4 += 1
	if li[i] != e[i]:
		cnt5 += 1
	if li[i] != f[i]:
		cnt6 += 1
if cnt1 == min(cnt1, cnt2, cnt3, cnt4, cnt5, cnt6):
	print(cnt1)
	print(''.join(a))
elif cnt2 == min(cnt1, cnt2, cnt3, cnt4, cnt5, cnt6):
	print(cnt2)
	print(''.join(b))
elif cnt3 == min(cnt1, cnt2, cnt3, cnt4, cnt5, cnt6):
	print(cnt3)
	print(''.join(c))
elif cnt4 == min(cnt1, cnt2, cnt3, cnt4, cnt5, cnt6):
	print(cnt4)
	print(''.join(d))
elif cnt5 == min(cnt1, cnt2, cnt3, cnt4, cnt5, cnt6):
	print(cnt5)
	print(''.join(e))
elif cnt6 == min(cnt1, cnt2, cnt3, cnt4, cnt5, cnt6):
	print(cnt6)
	print(''.join(f))


n = int(input())
s = list(input())
cnt = [[0] * 3 for i in range(3)]
f = [0] * 3
for i in range(n):
	f[i % 3] += 1
	if s[i] == 'R':
		cnt[i % 3][0] += 1
	if s[i] == 'G':
		cnt[i % 3][1] += 1
	if s[i] == 'B':
		cnt[i % 3][2] += 1
a = [10 ** 6] * 6
a[0] = f[0] - cnt[0][0] + f[1] - cnt[1][1] + f[2] - cnt[2][2]
a[1] = f[0] - cnt[0][0] + f[1] - cnt[1][2] + f[2] - cnt[2][1]
a[2] = f[0] - cnt[0][1] + f[1] - cnt[1][0] + f[2] - cnt[2][2]
a[3] = f[0] - cnt[0][1] + f[1] - cnt[1][2] + f[2] - cnt[2][0]
a[4] = f[0] - cnt[0][2] + f[1] - cnt[1][0] + f[2] - cnt[2][1]
a[5] = f[0] - cnt[0][2] + f[1] - cnt[1][1] + f[2] - cnt[2][0]
m = min(a)
ans = 0
if m == a[0]:
	for i in range(n):
		if i % 3 == 0 and s[i] != 'R':
			s[i] = 'R'
			ans += 1
		if i % 3 == 1 and s[i] != 'G':
			s[i] = 'G'
			ans += 1
		if i % 3 == 2 and s[i] != 'B':
			s[i] = 'B'
			ans += 1
	print(ans)
	print(''.join(s))
elif m == a[1]:
	for i in range(n):
		if i % 3 == 0 and s[i] != 'R':
			s[i] = 'R'
			ans += 1
		if i % 3 == 1 and s[i] != 'B':
			s[i] = 'B'
			ans += 1
		if i % 3 == 2 and s[i] != 'G':
			s[i] = 'G'
			ans += 1
	print(ans)
	print(''.join(s))
elif m == a[2]:
	for i in range(n):
		if i % 3 == 0 and s[i] != 'G':
			s[i] = 'G'
			ans += 1
		if i % 3 == 1 and s[i] != 'R':
			s[i] = 'R'
			ans += 1
		if i % 3 == 2 and s[i] != 'B':
			s[i] = 'B'
			ans += 1
	print(ans)
	print(''.join(s))
elif m == a[3]:
	for i in range(n):
		if i % 3 == 0 and s[i] != 'G':
			s[i] = 'G'
			ans += 1
		if i % 3 == 1 and s[i] != 'B':
			s[i] = 'B'
			ans += 1
		if i % 3 == 2 and s[i] != 'R':
			s[i] = 'R'
			ans += 1
	print(ans)
	print(''.join(s))
elif m == a[4]:
	for i in range(n):
		if i % 3 == 0 and s[i] != 'B':
			s[i] = 'B'
			ans += 1
		if i % 3 == 1 and s[i] != 'R':
			s[i] = 'R'
			ans += 1
		if i % 3 == 2 and s[i] != 'G':
			s[i] = 'G'
			ans += 1
	print(ans)
	print(''.join(s))
else:
	for i in range(n):
		if i % 3 == 0 and s[i] != 'B':
			s[i] = 'B'
			ans += 1
		if i % 3 == 1 and s[i] != 'G':
			s[i] = 'G'
			ans += 1
		if i % 3 == 2 and s[i] != 'R':
			s[i] = 'R'
			ans += 1
	print(ans)
	print(''.join(s))


n = int(input())
gir = input()
rgb = ['RGB', 'RBG', 'GRB', 'GBR', 'BGR', 'BRG']
changes = [0, 0, 0, 0, 0, 0]
for i in range(n):
	for j in range(6):
		if gir[i] != rgb[j][i % 3]:
			changes[j] += 1
print(min(changes))
beautiful_gir = [''] * n
pattern = changes.index(min(changes))
for i in range(n):
	beautiful_gir[i] = rgb[pattern][i % 3]
print(''.join(beautiful_gir))


import sys
import heapq
from math import ceil
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
n = int(ri())
st = ri()
dic = {'R': 'B', 'B': 'G', 'G': 'R'}
ans = [st[0]]
cnt = 0
for i in range(1, len(st)):
	if ans[-1] == st[i]:
		cnt += 1
		if i + 1 < len(st) and dic[st[i]] != st[i + 1]:
			ans.append(dic[st[i]])
		else:
			ans.append(dic[dic[st[i]]])
	else:
		ans.append(st[i])
print(cnt)
for i in ans:
	print(i, end='')
print()


from sys import stdin, stdout
n = int(stdin.readline())
string = stdin.readline()
nums = [0 for i in range(n)]
ct = [0 for j in range(6)]
cols = [[0, 0, 1, 1, 2, 2], [1, 2, 0, 2, 0, 1], [2, 1, 2, 0, 1, 0]]
dic = {0: 'R', 1: 'G', 2: 'B'}
for i in range(n):
	if string[i] == 'R':
		nums[i] = 0
	elif string[i] == 'G':
		nums[i] = 1
	elif string[i] == 'B':
		nums[i] = 2
	for j in range(6):
		if cols[i % 3][j] != nums[i]:
			ct[j] += 1
minj = 0
minct = n + 1
for j in range(6):
	if ct[j] < minct:
		minct = ct[j]
		minj = j
stdout.write(str(minct) + '\n')
strout = ''.join([dic[cols[i % 3][minj]] for i in range(n)])
stdout.write(strout + '\n')


t = int(input())
li = list(input())
count = 0
if t == 1:
	print(0)
	print(li[0])
else:
	i = 1
	while i < t - 1:
		if li[i] != li[i - 1]:
			i += 1
		else:
			if li[i - 1] != 'G' and li[i + 1] != 'G':
				li[i] = 'G'
				count += 1
			elif li[i - 1] != 'B' and li[i + 1] != 'B':
				li[i] = 'B'
				count += 1
			else:
				li[i] = 'R'
				count += 1
			i += 2
	if li[-1] == li[-2]:
		if li[-1] == 'B':
			li[-1] = 'G'
		else:
			li[-1] = 'B'
		count += 1
	print(count)
	for j in li:
		print(j, end='')
	print('\n', end='')


n = int(input())
a = [x for x in input()]

def choose_the_third(first, second):
	for c in 'RGB':
		if c not in (first, second):
			return c
	return ''
c = 0
for i in range(1, n):
	if a[i] == a[i - 1]:
		c += 1
		a[i] = choose_the_third(a[i + 1] if i < n - 1 else '', a[i - 1])
print(c)
print(''.join(a))


(n, string) = (int(input()), list(input()))
cnt = 0
for loc in range(1, n):
	(prev, curr, nex) = (string[loc - 1], string[loc], string[min(loc + 1, n - 1)])
	if prev != curr:
		continue
	posible = set('RGB') - {prev, nex}
	cnt += 1
	curr = list(posible)[0]
	string[loc] = curr
print(cnt)
print(''.join(string))


n = int(input())
s = input()
lens = len(s)
dp = [[0] * 5 for _ in range(lens + 5)]
parent = [[0] * 5 for _ in range(lens + 5)]
(R, G, B) = (1, 2, 3)
sss = '0RGB'
dp[0][R] = dp[0][G] = dp[0][B] = 1
if s[0] == 'R':
	dp[0][R] = 0
if s[0] == 'G':
	dp[0][G] = 0
if s[0] == 'B':
	dp[0][B] = 0
for i in range(1, lens):
	dp[i][R] = min(dp[i - 1][G], dp[i - 1][B]) + 1
	if dp[i][R] == dp[i - 1][G] + 1:
		parent[i][R] = G
	else:
		parent[i][R] = B
	dp[i][G] = min(dp[i - 1][R], dp[i - 1][B]) + 1
	if dp[i][G] == dp[i - 1][R] + 1:
		parent[i][G] = R
	else:
		parent[i][G] = B
	dp[i][B] = min(dp[i - 1][G], dp[i - 1][R]) + 1
	if dp[i][B] == dp[i - 1][G] + 1:
		parent[i][B] = G
	else:
		parent[i][B] = R
	if s[i] == 'R':
		dp[i][R] -= 1
	elif s[i] == 'G':
		dp[i][G] -= 1
	elif s[i] == 'B':
		dp[i][B] -= 1
ans = min(dp[lens - 1][R], dp[lens - 1][G], dp[lens - 1][B])
print(min(dp[lens - 1][R], dp[lens - 1][G], dp[lens - 1][B]))
ans2 = [0] * lens
if ans == dp[lens - 1][R]:
	i = lens - 1
	pp = R
	while i >= 0:
		ans2[i] = sss[pp]
		pp = parent[i][pp]
		i -= 1
elif ans == dp[lens - 1][G]:
	i = lens - 1
	pp = G
	while i >= 0:
		ans2[i] = sss[pp]
		pp = parent[i][pp]
		i -= 1
else:
	i = lens - 1
	pp = B
	while i >= 0:
		ans2[i] = sss[pp]
		pp = parent[i][pp]
		i -= 1
print(''.join(ans2))


n = int(input())
s = input()
d1 = 0
d2 = 0
d3 = 0
d4 = 0
d5 = 0
d6 = 0
s1 = ''
s2 = ''
s3 = ''
s4 = ''
s5 = ''
s6 = ''
for i in range(len(s)):
	if i % 3 == 0:
		s1 += 'R'
		s2 += 'R'
		s3 += 'G'
		s4 += 'G'
		s5 += 'B'
		s6 += 'B'
		if 'R' != s[i]:
			d1 += 1
		if 'R' != s[i]:
			d2 += 1
		if 'G' != s[i]:
			d3 += 1
		if 'G' != s[i]:
			d4 += 1
		if 'B' != s[i]:
			d5 += 1
		if 'B' != s[i]:
			d6 += 1
	elif i % 3 == 1:
		s1 += 'G'
		s2 += 'B'
		s3 += 'R'
		s4 += 'B'
		s5 += 'G'
		s6 += 'R'
		if 'G' != s[i]:
			d1 += 1
		if 'B' != s[i]:
			d2 += 1
		if 'R' != s[i]:
			d3 += 1
		if 'B' != s[i]:
			d4 += 1
		if 'G' != s[i]:
			d5 += 1
		if 'R' != s[i]:
			d6 += 1
	else:
		s1 += 'B'
		s2 += 'G'
		s3 += 'B'
		s4 += 'R'
		s5 += 'R'
		s6 += 'G'
		if 'B' != s[i]:
			d1 += 1
		if 'G' != s[i]:
			d2 += 1
		if 'B' != s[i]:
			d3 += 1
		if 'R' != s[i]:
			d4 += 1
		if 'R' != s[i]:
			d5 += 1
		if 'G' != s[i]:
			d6 += 1
m = min([d1, d2, d3, d4, d5, d6])
if m == d1:
	print(d1)
	print(s1)
elif m == d2:
	print(d2)
	print(s2)
elif m == d3:
	print(d3)
	print(s3)
elif m == d4:
	print(d4)
	print(s4)
elif m == d5:
	print(d5)
	print(s5)
else:
	print(d6)
	print(s6)


n = int(input())
(s, mn) = (input(), 999999999)
(a, b) = (['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR'], [])
for j in range(6):
	ans = 0
	temp = list(s)
	for i in range(n):
		if s[i] != a[j][i % 3]:
			ans += 1
			temp[i] = a[j][i % 3]
	if mn > ans:
		mn = ans
		b = temp
print(mn)
print(*b, sep='')


def solve():
	n = int(input())
	arr = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
	s = input()
	mv = ''
	mc = 10000000
	for val in arr:
		cnt = 0
		for (j, c) in enumerate(val):
			for i in range(j, len(s), 3):
				if s[i] != c:
					cnt += 1
		if mc > cnt:
			mc = cnt
			mv = val
	print(mc)
	for t in range(len(s) // len(mv)):
		print(mv, end='')
	if len(s) % len(mv) != 0:
		rem = len(s) % len(mv)
		for k in range(rem):
			print(mv[k], end='')
solve()


def recolor(s, per):
	recol = 0
	for i in range(3):
		if s[i] != per[i]:
			recol = recol + 1
	return recol
per = ['RGB', 'RBG', 'GBR', 'GRB', 'BRG', 'BGR']
len_ = int(input())
string = input()
old_acc = 200005
per_in = 0
for i in range(6):
	accum = 0
	n = 0
	while n + 3 <= len_:
		if string[n:n + 3] != per[i]:
			accum += recolor(string[n:n + 3], per[i])
		if accum >= old_acc:
			break
		n = n + 3
	for x in range(len_ % 3):
		if string[n + x] != per[i][x]:
			accum += 1
	if accum < old_acc:
		per_in = i
		old_acc = accum
out = len_ // 3 * per[per_in] + per[per_in][:len_ % 3]
print(old_acc)
print(out)


n = int(input())
i = 0
y = []
d = 0
s = input()
a = ['GRB', 'GBR', 'BGR', 'BRG', 'RBG', 'RGB']
for k in range(len(a)):
	for j in range(n):
		if s[j] != a[k][j % 3]:
			d = d + 1
	y.append(d)
	d = 0
print(min(y))
for j in range(n):
	print(a[y.index(min(y))][j % 3], end='')


n = int(input())
s = list(input())
vals = ['RGB', 'RBG', 'BGR', 'BRG', 'GBR', 'GRB']
new = []
for elem in vals:
	res = 0
	for i in range(n):
		if s[i] != elem[i % 3]:
			res += 1
	new.append(res)
res = 1000000
idx = 0
for i in range(len(new)):
	if new[i] <= res:
		res = new[i]
		idx = i
key = vals[idx]
print(res)
for i in range(n):
	if s[i] != key[i % 3]:
		s[i] = key[i % 3]
print(''.join(s))


import math

def min(Ar):
	id = 0
	a = Ar[0]
	for i in range(1, 6):
		if Ar[i] < a:
			a = Ar[i]
			id = i
	return (id, a)
n = int(input())
s = input()
k = math.ceil(n / 3)
lt = ['RGB' * k, 'RBG' * k, 'BGR' * k, 'BRG' * k, 'GRB' * k, 'GBR' * k]
a = b = c = d = e = f = 0
for i in range(n):
	if lt[0][i] != s[i]:
		a += 1
	if lt[1][i] != s[i]:
		b += 1
	if lt[2][i] != s[i]:
		c += 1
	if lt[3][i] != s[i]:
		d += 1
	if lt[4][i] != s[i]:
		e += 1
	if lt[5][i] != s[i]:
		f += 1
(i, a) = min([a, b, c, d, e, f])
print(a)
print(lt[i][:n])


def diff(a, b):
	count = 0
	for i in range(len(a)):
		if a[i] != b[i]:
			count += 1
	return count

def create(a, n):
	ans = a * (n // 3)
	temp = n - len(ans)
	ans = ans + a[0:temp]
	return ans
n = int(input())
s = input()
m = 1000000000
if n >= 3:
	temp = 'RGB'
	new = create(temp, n)
	temp2 = diff(new, s)
	if temp2 < m:
		m = temp2
		ans = new
	temp = 'RBG'
	new = create(temp, n)
	temp2 = diff(new, s)
	if temp2 < m:
		m = temp2
		ans = new
	temp = 'GBR'
	new = create(temp, n)
	temp2 = diff(new, s)
	if temp2 < m:
		m = temp2
		ans = new
	temp = 'GRB'
	new = create(temp, n)
	temp2 = diff(new, s)
	if temp2 < m:
		m = temp2
		ans = new
	temp = 'BRG'
	new = create(temp, n)
	temp2 = diff(new, s)
	if temp2 < m:
		m = temp2
		ans = new
	temp = 'BGR'
	new = create(temp, n)
	temp2 = diff(new, s)
	if temp2 < m:
		m = temp2
		ans = new
	print(m)
	print(ans)
elif n == 1:
	print(0)
	print(s)
elif n == 2:
	if s[0] != s[1]:
		print(0)
		print(s)
	else:
		print(1)
		if s[0] == 'R':
			print('RB')
		elif s[0] == 'B':
			print('BR')
		else:
			print('GB')


def GetMoves(s, move):
	new = move * int(len(s) / 3)
	c = len(s) % 3
	if c != 0:
		new += move[0]
		if c == 2:
			new += move[1]
	total = 0
	for i in range(len(s)):
		if s[i] != new[i]:
			total += 1
	return total

def main():
	n = int(input())
	s = input()
	moves = ['RGB', 'RBG', 'GBR', 'GRB', 'BGR', 'BRG']
	min_moves = float('inf')
	for move in moves:
		m = GetMoves(s, move)
		if m < min_moves:
			min_moves = m
			curr = move
	new = curr * int(len(s) / 3)
	c = n % 3
	if c != 0:
		new += curr[0]
		if c == 2:
			new += curr[1]
	if min_moves == float('inf'):
		min_moves = 0
	print(min_moves)
	print(new)
main()


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n,) = I()
s = input()
r = []
b = []
g = []
ans = ['RGB', 'RBG', 'GRB', 'GBR', 'BGR', 'BRG']
cost = MOD
res = ans[0]
for x in ans:
	d = 0
	for i in range(n):
		if s[i] != x[i % 3]:
			d += 1
	if d < cost:
		cost = d
		res = x
print(cost)
for i in range(n):
	print(res[i % 3], end='')


from sys import stdin, stdout
from collections import defaultdict
import math
I = stdin.readline
P = stdout.write
n = int(I())
s = I().rstrip()
val = dict()
val['R'] = 0
val['G'] = 1
val['B'] = 2
count = 0
arr = [s[0]]
for i in range(1, n):
	if s[i] == arr[-1]:
		count += 1
		if arr[-1] == 'R':
			if i != n - 1:
				if s[i + 1] == 'G':
					arr.append('B')
				else:
					arr.append('G')
			else:
				arr.append('G')
		elif arr[-1] == 'G':
			if i != n - 1:
				if s[i + 1] == 'B':
					arr.append('R')
				else:
					arr.append('B')
			else:
				arr.append('B')
		elif arr[-1] == 'B':
			if i != n - 1:
				if s[i + 1] == 'G':
					arr.append('R')
				else:
					arr.append('G')
			else:
				arr.append('G')
	else:
		arr.append(s[i])
print(count)
print(''.join(arr))


R = lambda : map(int, input().split())
n = int(input())
s = list(input())
cnt = 0
for i in range(1, n):
	if s[i] == s[i - 1]:
		for c in 'RGB':
			if c != s[i - 1] and (i == n - 1 or c != s[i + 1]):
				s[i] = c
				cnt += 1
				break
print(cnt)
print(''.join(s))


n = int(input())
a = list(input())
t = 0
if n == 1:
	print(0)
	print(*a)
elif n == 2:
	if a[0] != a[1]:
		print(0)
		print(*a, sep='')
	else:
		print(1)
		if a[0] == 'R':
			a[1] = 'G'
		elif a[0] == 'G':
			a[1] = 'R'
		elif a[0] == 'B':
			a[1] = 'R'
		print(*a, sep='')
else:
	for i in range(n - 2):
		if a[i] == a[i + 1]:
			if a[i] == 'R' and a[i + 2] != 'B':
				a[i + 1] = 'B'
			elif a[i] == 'R' and a[i + 2] != 'G':
				a[i + 1] = 'G'
			elif a[i] == 'G' and a[i + 2] != 'B':
				a[i + 1] = 'B'
			elif a[i] == 'G' and a[i + 2] != 'R':
				a[i + 1] = 'R'
			elif a[i] == 'B' and a[i + 2] != 'G':
				a[i + 1] = 'G'
			elif a[i] == 'B' and a[i + 2] != 'R':
				a[i + 1] = 'R'
			t = t + 1
	if a[n - 1] == a[n - 2]:
		if a[n - 3] == 'R' and a[n - 1] != 'B':
			a[n - 2] = 'B'
		elif a[n - 3] == 'R' and a[n - 1] != 'G':
			a[n - 2] = 'G'
		elif a[n - 3] == 'G' and a[n - 1] != 'B':
			a[n - 2] = 'B'
		elif a[n - 3] == 'G' and a[n - 1] != 'R':
			a[n - 2] = 'R'
		elif a[n - 3] == 'B' and a[n - 1] != 'G':
			a[n - 2] = 'G'
		elif a[n - 3] == 'B' and a[n - 1] != 'R':
			a[n - 2] = 'R'
		t = t + 1
	print(t)
	print(*a, sep='')


n = int(input())
ls = input()
colors = ['G', 'R', 'B']
po = []
for c1 in colors:
	for c2 in colors:
		for c3 in colors:
			if c1 != c2 and c2 != c3 and (c1 != c3):
				po.append([c1, c2, c3])
choose = -1
min = 1000000
for (ind, p) in enumerate(po):
	s = 0
	for i in range(n):
		m = i % 3
		if ls[i] != p[m]:
			s += 1
	if s < min:
		choose = ind
		min = s
solution = []
pos = po[choose]
for i in range(n):
	m = i % 3
	solution.append(pos[m])
print(min)
print(''.join(solution))


def get_color(left, right):
	if right is None:
		if left == 'R':
			return 'G'
		elif left == 'G' or left == 'B':
			return 'R'
	elif left == 'G' and right == 'G':
		return 'R'
	elif left == 'R' and right == 'G' or (left == 'G' and right == 'R'):
		return 'B'
	elif left == 'G' and right == 'B' or (left == 'B' and right == 'G'):
		return 'R'
	else:
		return 'G'
n = int(input())
s = list(input())
(i, r) = (0, 0)
while i < len(s) - 1:
	if s[i] == s[i + 1]:
		r += 1
		s[i + 1] = get_color(s[i], s[i + 2] if i < len(s) - 2 else None)
		i += 2
	else:
		i += 1
print(r)
print(''.join(s))


n = int(input())
s0 = input()
s = []
res = 0
for i in range(len(s0)):
	s.append(s0[i])
s.append('B')
for i in range(len(s) - 2):
	if s[i] == s[i + 1]:
		if s[i] == 'R':
			if s[i + 2] == 'R':
				s[i + 1] = 'G'
			if s[i + 2] == 'G':
				s[i + 1] = 'B'
			if s[i + 2] == 'B':
				s[i + 1] = 'G'
		if s[i] == 'B':
			if s[i + 2] == 'B':
				s[i + 1] = 'G'
			if s[i + 2] == 'G':
				s[i + 1] = 'R'
			if s[i + 2] == 'R':
				s[i + 1] = 'G'
		if s[i] == 'G':
			if s[i + 2] == 'G':
				s[i + 1] = 'B'
			if s[i + 2] == 'R':
				s[i + 1] = 'B'
			if s[i + 2] == 'B':
				s[i + 1] = 'R'
		res += 1
print(res)
print(''.join(map(str, s[:n])))


from itertools import permutations

def main():
	n = int(input())
	s = input()
	prms = list(permutations('RGB'))
	cost = 1000000000.0
	for item in prms:
		prms_li = []
		diff = 0
		for i in range(n):
			prms_li.append(item[i % 3])
			diff += s[i] is not prms_li[i]
		if diff < cost:
			cost = diff
			ans = prms_li
	print(cost)
	print(''.join(ans))
main()


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import combinations
import functools
import sys
import math
MAX = sys.maxsize
MAXN = 10 ** 6 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN():
	return map(int, sys.stdin.readline().strip().split())

def charIN():
	return sys.stdin.readline().strip().split()

def ncr(n, k):
	res = 1
	c = [0] * (k + 1)
	c[0] = 1
	for i in range(1, n + 1):
		for j in range(min(i, k), 0, -1):
			c[j] = (c[j] + c[j - 1]) % MOD
	return c[k]
x = ['B', 'G', 'R']
n = int(input())
s = [i for i in input()]
if n == 1:
	print(0)
	print(''.join(s))
	exit(0)
if n == 2:
	if s[0] != s[1]:
		print(0)
		print(''.join(s))
	else:
		print(1)
		ind = x.index(s[0])
		if ind == 0:
			s[0] = x[1]
		else:
			s[0] = x[0]
		print(''.join(s))
	exit(0)
l = ['RBG', 'RGB', 'GRB', 'GBR', 'BGR', 'BRG']
mn = MAX
fin = ''
for i in l:
	x = i * (n // 3) + i[:n % 3]
	cnt = 0
	for j in range(n):
		if x[j] != s[j]:
			cnt += 1
	if cnt < mn:
		mn = cnt
		fin = x
print(mn)
print(fin)


sa = lambda : input()
sb = lambda : int(input())
sc = lambda : input().split()
sd = lambda : list(map(int, input().split()))
se = lambda : float(input())
import math

def hnbhai():
	n = sb()
	a = list(sa())
	t = float('inf')
	ind = -1
	d = ['RBG', 'RGB', 'BRG', 'BGR', 'GRB', 'GBR']
	for i in range(6):
		x = 0
		for j in range(n):
			if a[j] != d[i][j % 3]:
				x += 1
		t = min(t, x)
		if t == x:
			ind = i
	ans = d[ind] * (n // 3) + d[ind][:n % 3]
	print(t)
	print(ans)
hnbhai()


n = int(input())
a = input()
s = [0] * n
for i in range(n):
	s[i] = a[i]
i = 0
ans = 0
while i < n - 1:
	if i == n - 2:
		if s[i] == s[i + 1]:
			if s[i] == 'R':
				s[i + 1] = 'B'
				ans += 1
			elif s[i] == 'B':
				s[i + 1] = 'R'
				ans += 1
			else:
				s[i + 1] = 'R'
				ans += 1
	elif s[i] == s[i + 1] and s[i] == s[i + 2]:
		if s[i] == 'R':
			s[i + 1] = 'G'
			ans += 1
		elif s[i] == 'G':
			s[i + 1] = 'R'
			ans += 1
		else:
			s[i + 1] = 'R'
			ans += 1
	elif s[i] == s[i + 1]:
		if s[i] == 'R':
			if s[i + 2] == 'B':
				s[i + 1] = 'G'
				ans += 1
			else:
				s[i + 1] = 'B'
				ans += 1
		elif s[i] == 'B':
			if s[i + 2] == 'R':
				s[i + 1] = 'G'
				ans += 1
			else:
				s[i + 1] = 'R'
				ans += 1
		elif s[i + 2] == 'R':
			s[i + 1] = 'B'
			ans += 1
		else:
			s[i + 1] = 'R'
			ans += 1
	i += 1
print(ans)
for i in range(n):
	print(s[i], end='')
print()


n = int(input())
s = input()
col = 'RGB'
lt = [col.index(c) for c in s] + [3]
ans = 0
for i in range(1, len(lt)):
	if lt[i] == lt[i - 1]:
		ans += 1
		lt[i] = (lt[i] + 1) % 3
		if lt[i] == lt[i + 1]:
			lt[i] = (lt[i] + 1) % 3
print(ans)
print(''.join([col[c] for c in lt[:-1]]))


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict, deque, Counter, OrderedDict
import threading
from heapq import *

def main():
	n = int(input())
	s = input()
	RGB = [0, 0, 0]
	RBG = [0, 0, 0]
	BGR = [0, 0, 0]
	BRG = [0, 0, 0]
	GBR = [0, 0, 0]
	GRB = [0, 0, 0]
	x = 0
	while 1:
		if x == n:
			break
		if x % 3 == 0:
			if s[x] == 'R':
				RGB[0] += 1
				RBG[0] += 1
			if s[x] == 'B':
				BGR[0] += 1
				BRG[0] += 1
			if s[x] == 'G':
				GBR[0] += 1
				GRB[0] += 1
		elif x % 3 == 1:
			if s[x] == 'R':
				BRG[1] += 1
				GRB[1] += 1
			if s[x] == 'B':
				RBG[1] += 1
				GBR[1] += 1
			if s[x] == 'G':
				RGB[1] += 1
				BGR[1] += 1
		else:
			if s[x] == 'R':
				BGR[2] += 1
				GBR[2] += 1
			if s[x] == 'B':
				RGB[2] += 1
				GRB[2] += 1
			if s[x] == 'G':
				RBG[2] += 1
				BRG[2] += 1
		x += 1
	ans = [float('inf'), 'a']
	if n - sum(RGB) < ans[0]:
		ans = [n - sum(RGB), 'RGB']
	if n - sum(RBG) < ans[0]:
		ans = [n - sum(RBG), 'RBG']
	if n - sum(BGR) < ans[0]:
		ans = [n - sum(BGR), 'BGR']
	if n - sum(BRG) < ans[0]:
		ans = [n - sum(BRG), 'BRG']
	if n - sum(GBR) < ans[0]:
		ans = [n - sum(GBR), 'GBR']
	if n - sum(GRB) < ans[0]:
		ans = [n - sum(GRB), 'GRB']
	print(ans[0])
	for i in range(n):
		if i % 3 == 0:
			print(ans[1][0], end='')
		if i % 3 == 1:
			print(ans[1][1], end='')
		if i % 3 == 2:
			print(ans[1][2], end='')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from itertools import *
m = int(input())
h = input()
(r, t) = min(((sum((x != y for (x, y) in zip(h, cycle(t)))), t) for t in permutations('RGB')))
print(r, ''.join(t * m)[:m])


import sys

def input():
	return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
from itertools import permutations
N = int(input())
S = input()
ans = INF
for perm in permutations('RGB'):
	cnt = 0
	t = ''
	for j in range(len(S)):
		t += perm[j % 3]
		if S[j] != perm[j % 3]:
			cnt += 1
	if cnt < ans:
		ans = cnt
		T = t
print(ans)
print(T)


n = int(input())
d = {'R': 0, 'G': 1, 'B': 2}
a = {0: 'R', 1: 'G', 2: 'B'}
s = [d[i] for i in input()]
s.append(-1)
beg = 0
i = 1
res = 0
while i < n + 1:
	if s[i - 1] != s[i]:
		if i - beg > 1:
			j = beg + 1
			while j < i:
				s[j] = {0, 1, 2}.difference({s[j - 1], s[j + 1]}).pop()
				res += 1
				j += 2
		beg = i
	i += 1
print(res)
for i in range(n):
	print(a[s[i]], end='')


n = int(input())
s = input()
d = s[0]
c = 0
past = s[0]
for i in range(1, n - 1):
	if past == s[i]:
		c += 1
		for j in 'RGB':
			if j != past and j != s[i + 1]:
				d += j
				past = j
				break
	else:
		d += s[i]
		past = s[i]
if n != 1:
	if d[-1] == s[-1]:
		c += 1
		for i in 'RGB':
			if i != s[-1]:
				d += i
				break
	else:
		d += s[-1]
print(c)
print(d)


n = int(input())
s = list(input())
if n == 1:
	print(0)
	print(s[0])
	exit()
count = 0
for i in range(len(s) - 2):
	if s[i] == s[i + 1]:
		count += 1
		if s[i] == 'R':
			if s[i + 2] == 'G':
				s[i + 1] = 'B'
			elif s[i + 2] == 'B':
				s[i + 1] = 'G'
			else:
				s[i + 1] = 'B'
		elif s[i] == 'B':
			if s[i + 2] == 'G':
				s[i + 1] = 'R'
			elif s[i + 2] == 'R':
				s[i + 1] = 'G'
			else:
				s[i + 1] = 'R'
		elif s[i] == 'G':
			if s[i + 2] == 'R':
				s[i + 1] = 'B'
			elif s[i + 2] == 'B':
				s[i + 1] = 'R'
			else:
				s[i + 1] = 'R'
if s[n - 2] == s[n - 1]:
	count += 1
	if s[n - 2] == 'R':
		if s[n - 3] == 'B':
			s[n - 1] = 'G'
		else:
			s[n - 1] = 'B'
	if s[n - 2] == 'B':
		if s[n - 3] == 'R':
			s[n - 1] = 'G'
		else:
			s[n - 1] = 'R'
	if s[n - 2] == 'G':
		if s[n - 3] == 'B':
			s[n - 1] = 'R'
		else:
			s[n - 1] = 'B'
print(count)
for i in range(len(s)):
	print(s[i], end='')


n = int(input())
s = list(input())
ans = 0
for _ in range(n):
	color = ['R', 'G', 'B']
	color.remove(s[_])
	if _ + 1 in range(n) and s[_] == s[_ + 1]:
		if _ + 2 in range(n) and s[_ + 2] in color:
			color.remove(s[_ + 2])
		ans += 1
		s[_ + 1] = color[0]
print(int(ans))
for _______ in s:
	print(_______, end='')


from collections import Counter
n = int(input())
c = input()
x = c[::3]
y = c[1::3]
z = c[2::3]
u = dict(Counter(x))
v = dict(Counter(y))
w = dict(Counter(z))
a = [0] * 6
b = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
a[0] = n - (u.get('R', 0) + v.get('G', 0) + w.get('B', 0))
a[1] = n - (u.get('R', 0) + v.get('B', 0) + w.get('G', 0))
a[2] = n - (u.get('G', 0) + v.get('R', 0) + w.get('B', 0))
a[3] = n - (u.get('G', 0) + v.get('B', 0) + w.get('R', 0))
a[4] = n - (u.get('B', 0) + v.get('R', 0) + w.get('G', 0))
a[5] = n - (u.get('B', 0) + v.get('G', 0) + w.get('R', 0))
d = min(a)
e = a.index(d)
print(d)
d = [b[e]] * (n // 3 + 1)
d = ''.join(d)
print(d[:n])


input()
lst = list(input())
cnt = 0
if len(lst) == 1:
	print(0)
	print(*lst)
	exit(0)
if len(lst) == 2:
	if lst[0] == lst[1]:
		print(1)
		print(lst[0] + ('R' if lst[0] != 'R' else 'G'))
	else:
		print(0)
		print(*lst)
	exit(0)
for i in range(1, len(lst) - 1):
	if lst[i] != lst[i - 1]:
		continue
	cnt += 1
	if lst[i - 1] == lst[i + 1]:
		lst[i] = 'R' if lst[i - 1] != 'R' else 'G'
	else:
		lst[i] = chr(219 - ord(lst[i - 1]) - ord(lst[i + 1]))
if lst[-1] == lst[-2]:
	lst[-1] = 'R' if lst[-2] != 'R' else 'G'
	cnt += 1
print(cnt)
print(*lst, sep='')


n = int(input())
si = input()
s = []
for i in si:
	s.append(i)
dic = {0: 'R', 1: 'G', 2: 'B'}
dic2 = {'R': 0, 'G': 1, 'B': 2}
c = 0
for i in range(1, len(s)):
	if i == len(s) - 1:
		if s[i] == s[i - 1]:
			s[i] = dic[(dic2[s[i]] + 1) % 3]
			c += 1
	elif s[i] == s[i - 1]:
		if s[i + 1] == s[i - 1]:
			s[i] = dic[(dic2[s[i]] + 1) % 3]
			c += 1
		else:
			temp = [False] * 3
			temp[dic2[s[i - 1]]] = True
			temp[dic2[s[i + 1]]] = True
			for j in range(3):
				if not temp[j]:
					s[i] = dic[j]
					c += 1
print(c)
for i in s:
	print(i, end='')


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 sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(n,) = I()
s = input().strip()
an = n
rr = -1
st = ['RGB', 'GBR', 'GRB', 'RBG', 'BRG', 'BGR']
for i in range(6):
	r = st[i] * (n // 3) + st[i][:n % 3]
	x = 0
	for j in range(n):
		if r[j] != s[j]:
			x += 1
	if x < an:
		rr = i
		an = x
print(an)
print(st[rr] * (n // 3) + st[rr][:n % 3])


n = int(input())
l = list(input()) + ['l']
D = ['R', 'B', 'G']
c = 0
for i in range(1, n):
	a = 0
	if l[i] == l[i - 1]:
		c += 1
		l[i] = D[a]
		while l[i] == l[i - 1] or l[i] == l[i + 1]:
			a += 1
			l[i] = D[a]
print(c)
print(''.join(l[:n]))


n = int(input())
s = input()
a = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
q = int(n // 3)
r = n % 3
str = []
v = [0] * 6
for i in range(6):
	str.append(a[i] * q + a[i][0:r])
	for j in range(q):
		x = s[3 * j:3 * j + 3]
		if x != a[i]:
			if x[0] != a[i][0]:
				v[i] += 1
			if x[1] != a[i][1]:
				v[i] += 1
			if x[2] != a[i][2]:
				v[i] += 1
	x = s[3 * q:3 * q + r]
	for k in range(r):
		if x[k] != a[i][k]:
			v[i] += 1
mi = min(v)
for i in range(6):
	if v[i] == mi:
		print(mi)
		print(str[i])
		break


n = int(input())
s = [i for i in input()]
r = 0
m = [0] * n
if n == 1:
	print(0)
	print(s[0])
else:
	for i in range(1, n):
		if s[i] == s[i - 1] and m[i - 1] == 0:
			m[i] = 1
			r += 1
	for i in range(1, n - 1):
		if m[i] == 1:
			if s[i - 1] == 'R' and s[i + 1] == 'G' or (s[i - 1] == 'G' and s[i + 1] == 'R'):
				s[i] = 'B'
			if s[i - 1] == 'R' and s[i + 1] == 'B' or (s[i - 1] == 'B' and s[i + 1] == 'R'):
				s[i] = 'G'
			if s[i - 1] == 'G' and s[i + 1] == 'B' or (s[i - 1] == 'B' and s[i + 1] == 'G'):
				s[i] = 'R'
			if s[i - 1] == s[i + 1] == 'R':
				s[i] = 'G'
			if s[i - 1] == s[i + 1] == 'G':
				s[i] = 'B'
			if s[i - 1] == s[i + 1] == 'B':
				s[i] = 'R'
	if m[-1] == 1:
		if s[-2] == 'R' or s[-2] == 'G':
			s[-1] = 'B'
		else:
			s[-1] = 'R'
	print(r)
	print(''.join(s))


n = int(input())
s = str(input())
a = []
for i in range(n):
	if s[i] == 'R':
		a.append(0)
	elif s[i] == 'G':
		a.append(1)
	else:
		a.append(2)
q = [(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 1, 0), (2, 0, 1)]
ans = n + 1
ss = 0
sss = 0
for (i, j, k) in q:
	su = 0
	for t in range(n):
		if t % 3 == 0:
			if a[t] != i:
				su += 1
		elif t % 3 == 1:
			if a[t] != j:
				su += 1
		elif a[t] != k:
			su += 1
	if ans > su:
		ans = su
		sss = ss
	ss += 1
an = ['R', 'G', 'B']
anss = []
i = 0
while i < n:
	anss.append(an[q[sss][i % 3]])
	i += 1
print(ans)
print(''.join(anss))


from itertools import cycle, product, permutations
length = int(input())
word = list(input())
index = [0, 1, 2]
colors = ['R', 'G', 'B']
counts = {(ix, c): 0 for (ix, c) in product(index, colors)}
for (ix, c) in zip(cycle(index), word):
	counts[ix, c] += 1
max_value = 0
for (a, b, c) in permutations(colors):
	value = counts[0, a] + counts[1, b] + counts[2, c]
	if value >= max_value:
		max_recolor = [a, b, c]
		max_value = value
print(length - max_value)
print(''.join((x for (_, x) in zip(range(length), cycle(max_recolor)))))


n = int(input())
a = list(input())
i = 0
l = 0
while i < n - 1:
	if a[i] != a[i + 1]:
		i += 1
	else:
		j = i
		p = 0
		while j < n:
			if a[j] == a[i]:
				p = p + 1
				j += 1
			else:
				break
		if j == n:
			if a[i] == 'R':
				k = i
				t = 0
				while k < j:
					if t % 2 == 1:
						l += 1
						a[k] = 'G'
					t += 1
					k += 1
			if a[i] == 'G':
				k = i
				t = 0
				while k < j:
					if t % 2 == 1:
						l += 1
						a[k] = 'B'
					t += 1
					k += 1
			if a[i] == 'B':
				k = i
				t = 0
				while k < j:
					if t % 2 == 1:
						l += 1
						a[k] = 'G'
					t += 1
					k += 1
			i = j
		elif p % 2 == 1:
			if a[i] == 'R':
				k = i
				t = 0
				while k < j:
					if t % 2 == 1:
						l += 1
						a[k] = 'G'
					t += 1
					k += 1
			if a[i] == 'G':
				k = i
				t = 0
				while k < j:
					if t % 2 == 1:
						l += 1
						a[k] = 'B'
					t += 1
					k += 1
			if a[i] == 'B':
				k = i
				t = 0
				while k < j:
					if t % 2 == 1:
						l += 1
						a[k] = 'G'
					t += 1
					k += 1
			i = j
		else:
			if a[i] == 'R':
				if a[j] == 'B':
					z = 'G'
				if a[j] == 'G':
					z = 'B'
			if a[i] == 'G':
				if a[j] == 'B':
					z = 'R'
				if a[j] == 'R':
					z = 'B'
			if a[i] == 'B':
				if a[j] == 'R':
					z = 'G'
				if a[j] == 'G':
					z = 'R'
			if a[i] == 'R':
				k = i
				t = 0
				while k < j:
					if t % 2 == 1:
						l += 1
						a[k] = z
					t += 1
					k += 1
			if a[i] == 'G':
				k = i
				t = 0
				while k < j:
					if t % 2 == 1:
						l += 1
						a[k] = z
					t += 1
					k += 1
			if a[i] == 'B':
				k = i
				t = 0
				while k < j:
					if t % 2 == 1:
						l += 1
						a[k] = z
					t += 1
					k += 1
			i = j
print(l)
print(''.join(a))


n = int(input())
s = input()
l = list(s)
c = 0
for i in range(n - 1):
	if l[i] == l[i + 1]:
		c = c + 1
		if i != n - 2:
			if l[i] == l[i + 1] == 'R':
				if l[i + 2] == 'B' or l[i + 2] == 'R':
					l[i + 1] = 'G'
				elif l[i + 2] == 'G':
					l[i + 1] = 'B'
			elif l[i] == l[i + 1] == 'B':
				if l[i + 2] == 'R' or l[i + 2] == 'B':
					l[i + 1] = 'G'
				elif l[i + 2] == 'G':
					l[i + 1] = 'R'
			elif l[i + 2] == 'G' or l[i + 2] == 'B':
				l[i + 1] = 'R'
			else:
				l[i + 1] = 'B'
			i = i + 1
		else:
			if l[i] == 'R':
				l[i + 1] = 'B'
			elif l[i] == 'B':
				l[i + 1] = 'G'
			else:
				l[i + 1] = 'R'
			i = i + 1
	else:
		i = i + 1
print(c)
print(''.join(l))


def solve(n, s):
	replacements = {'RB': 'RG', 'RG': 'RB', 'RR': 'RB', 'GR': 'GB', 'GB': 'GR', 'GG': 'GR', 'BR': 'BG', 'BG': 'BR', 'BB': 'BR'}
	(nb_changes, s_updated, index) = (0, s[0], 1)
	while index < n:
		prev_char = s_updated[index - 1]
		cur_char = s[index]
		next_char = s[index + 1] if index + 1 < n else None
		if prev_char == cur_char:
			nb_changes += 1
			if next_char is None:
				s_updated += replacements[prev_char + cur_char][1]
			else:
				s_updated += replacements[cur_char + next_char][1]
		else:
			s_updated += s[index]
		index += 1
	return (nb_changes, s_updated)
n = int(input())
s = input().strip()
(nb_changes, s_updated) = solve(n, s)
print('{} {}'.format(nb_changes, s_updated))


n = int(input())
s = input()
k = 0
lis = []
for i in range(len(s)):
	if i % 3 == 0 and s[i] != 'G':
		k += 1
	if i % 3 == 1 and s[i] != 'R':
		k += 1
	if i % 3 == 2 and s[i] != 'B':
		k += 1
lis.append([k, 'GRB'])
k = 0
for i in range(len(s)):
	if i % 3 == 0 and s[i] != 'G':
		k += 1
	if i % 3 == 1 and s[i] != 'B':
		k += 1
	if i % 3 == 2 and s[i] != 'R':
		k += 1
lis.append([k, 'GBR'])
k = 0
for i in range(len(s)):
	if i % 3 == 0 and s[i] != 'R':
		k += 1
	if i % 3 == 1 and s[i] != 'G':
		k += 1
	if i % 3 == 2 and s[i] != 'B':
		k += 1
lis.append([k, 'RGB'])
k = 0
for i in range(len(s)):
	if i % 3 == 0 and s[i] != 'R':
		k += 1
	if i % 3 == 1 and s[i] != 'B':
		k += 1
	if i % 3 == 2 and s[i] != 'G':
		k += 1
lis.append([k, 'RBG'])
k = 0
for i in range(len(s)):
	if i % 3 == 0 and s[i] != 'B':
		k += 1
	if i % 3 == 1 and s[i] != 'R':
		k += 1
	if i % 3 == 2 and s[i] != 'G':
		k += 1
lis.append([k, 'BRG'])
k = 0
for i in range(len(s)):
	if i % 3 == 0 and s[i] != 'B':
		k += 1
	if i % 3 == 1 and s[i] != 'G':
		k += 1
	if i % 3 == 2 and s[i] != 'R':
		k += 1
lis.append([k, 'BGR'])
lis.sort()
ans = lis[0][0]
l = ''
for i in range(n // 3):
	l = l + lis[0][1]
a = lis[0][1]
l = l + a[:n % 3]
print(ans)
print(l)


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())
L = list(input())
arr = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for i in range(n):
	if L[i] == 'R':
		arr[i % 3][0] += 1
	elif L[i] == 'G':
		arr[i % 3][1] += 1
	else:
		arr[i % 3][2] += 1
arr6 = [arr[0][0] + arr[1][1] + arr[2][2], arr[0][0] + arr[1][2] + arr[2][1], arr[0][1] + arr[1][0] + arr[2][2], arr[0][1] + arr[1][2] + arr[2][0], arr[0][2] + arr[1][0] + arr[2][1], arr[0][2] + arr[1][1] + arr[2][0]]
maxsum = 0
ind = -1
for i in range(6):
	if arr6[i] >= maxsum:
		maxsum = arr6[i]
		ind = i
print(sum([sum(k) for k in arr]) - maxsum)
select = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
longstr = select[ind] * (n // 3 + 1) * 3
print(longstr[0:n])


n = int(input())
a = [x for x in input()]
cs = [{'R': 0, 'G': 0, 'B': 0} for i in range(3)]
for (i, x) in enumerate(a):
	cs[i % 3][x] += 1
mincount = n
best = ''
for sbst in ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']:
	count = sum([sum([v for (k, v) in ns.items() if k != c]) for (c, ns) in zip(sbst, cs)])
	if count < mincount:
		mincount = count
		best = sbst
print(mincount)
for i in range(n):
	print(best[i % 3], end='')


n = int(input())
s = input()
A = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
B = 6 * [0]
for i in range(n):
	for j in range(6):
		if s[i] != A[j][i % 3]:
			B[j] += 1
y = min(B)
z = B.index(y)
b = A[z]
v = n % 3
print(y)
print(A[z] * (n // 3) + b[:v])


from itertools import *
n = int(input())
garland = input()
allGarlands = dict()
tmp = tuple(permutations('RGB', 3))
for i in range(len(tmp)):
	allGarlands[tmp[i]] = 0
for i in range(n):
	for current in allGarlands:
		if current[i % 3] != garland[i]:
			allGarlands[current] += 1
minGarland = n + 1
key = 0
for cur in allGarlands:
	if allGarlands[cur] < minGarland:
		minGarland = allGarlands[cur]
		key = cur
print(minGarland)
print(''.join(key * (n // 3)), end='')
for i in range(n % 3):
	print(key[i], end='')


from collections import defaultdict
n = int(input())
s = input()
c = 0
d = {}
i = 0
while i < n - 1:
	if s[i] == s[i + 1]:
		if i + 2 < n and s[i] == s[i + 2]:
			if s[i] == 'R':
				d[i + 1] = 'G'
			elif s[i] == 'G':
				d[i + 1] = 'B'
			else:
				d[i + 1] = 'R'
			i += 2
		elif i + 2 < n:
			if s[i] == 'R' and s[i + 2] == 'G' or (s[i] == 'G' and s[i + 2] == 'R'):
				d[i + 1] = 'B'
			elif s[i] == 'R' and s[i + 2] == 'B' or (s[i] == 'B' and s[i + 2] == 'R'):
				d[i + 1] = 'G'
			elif s[i] == 'B' and s[i + 2] == 'G' or (s[i] == 'G' and s[i + 2] == 'B'):
				d[i + 1] = 'R'
			i += 2
		else:
			i += 1
	else:
		i += 1
if n - 2 >= 0 and s[n - 1] == s[n - 2] and (n - 2 not in d):
	if s[n - 2] == 'G':
		d[n - 1] = 'R'
	elif s[n - 2] == 'R':
		d[n - 1] = 'G'
	else:
		d[n - 1] = 'R'
ans = [0] * n
for i in d:
	ans[i] = d[i]
for i in range(n):
	if ans[i] == 0:
		ans[i] = s[i]
print(len(d.keys()))
print(*ans, sep='')


import itertools
n = int(input())
s = input()
min_count = float('inf')
min_sequence = ''
for p in itertools.permutations('RGB'):
	c = 0
	sequence = list(s)
	for i in range(n):
		if p[i % 3] != s[i]:
			c += 1
			sequence[i] = p[i % 3]
	if min_count > c:
		min_count = c
		min_sequence = sequence
print(min_count)
print(''.join(min_sequence))


import sys
from itertools import dropwhile
data = sys.stdin.read().splitlines()
n = int(data[0])
line = data[1]
s = list(line) + ['$']
ans = 0
seed = 'RGB'
for i in range(1, n):
	if s[i - 1] == s[i]:
		ans += 1
		s[i] = next(dropwhile(lambda x: x == s[i - 1] or x == s[i + 1], iter(seed)))
s.pop()
print(ans)
print(''.join(s))


import sys
from math import *
n = int(input())
dat = input()
ts = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
out = ''
best = 99999999999
for templ in ts:
	s = ''
	while len(s) < n:
		s += templ
	s = s[:n]
	v = 0
	for (ind, it) in enumerate(s):
		if it != dat[ind]:
			v += 1
	if v < best:
		out = s
		best = v
print(best)
print(out)


import sys, math, string
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
d = 'RBG'
n = int(input())
s = list(input().strip())
i = 0
c = 0
if n == 1:
	print(0)
	print(''.join(s))
else:
	while i < n - 2:
		if s[i] == s[i + 1]:
			c += 1
			if s[i + 2] == s[i]:
				f = list(d)
				f.remove(s[i])
				s[i + 1] = f[0]
			else:
				f = list(d)
				f.remove(s[i + 2])
				f.remove(s[i])
				s[i + 1] = f[0]
			i += 1
		i += 1
	if s[-2] == s[-1]:
		f = list(d)
		c += 1
		f.remove(s[-1])
		s[-1] = f[0]
	print(c)
	print(''.join(s))


l = int(input())
a = input()
col = [['R', 'G', 'B'], ['R', 'B', 'G'], ['B', 'G', 'R'], ['B', 'R', 'G'], ['G', 'R', 'B'], ['G', 'B', 'R']]
mini = l + 1
cur = 0
for j in range(0, 6):
	cnt = 0
	for i in range(0, len(a), 3):
		if a[i] != col[j][0]:
			cnt += 1
	for i in range(1, len(a), 3):
		if a[i] != col[j][1]:
			cnt += 1
	for i in range(2, len(a), 3):
		if a[i] != col[j][2]:
			cnt += 1
	if cnt < mini:
		mini = cnt
		cur = j
print(mini)
for i in range(0, l):
	if i % 3 == 0:
		print(col[cur][0], end='')
	elif i % 3 == 1:
		print(col[cur][1], end='')
	else:
		print(col[cur][2], end='')


n = int(input())
ss = input()
l = ss
s = []
s.append('&')
for i in l:
	s.append(i)
s.append('&')
count = 0
for i in range(n):
	if s[i] == s[i + 1]:
		if 'B' != s[i] and 'B' != s[i + 2]:
			s[i + 1] = 'B'
		elif 'G' != s[i + 2] and 'G' != s[i]:
			s[i + 1] = 'G'
		elif 'R' != s[i + 2] and 'R' != s[i]:
			s[i + 1] = 'R'
		count += 1
print(count)
for i in range(1, n + 1):
	print(s[i], end='')


def gheir(s):
	if s == 'G' or s == 'R':
		return 'B'
	else:
		return 'R'

def gheir2(s, k):
	if s == 'G' and k == 'B':
		return 'R'
	if s == 'G' and k == 'R':
		return 'B'
	if s == 'R' and k == 'B':
		return 'G'
	if s == 'R' and k == 'G':
		return 'B'
	if s == 'B' and k == 'G':
		return 'R'
	if s == 'B' and k == 'R':
		return 'G'
n = int(input())
st = input()
st += gheir(st[-1])
dic = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
i = 0
change = 0
ans = ''
while i <= n:
	char = st[i]
	lent = 1
	j = i + 1
	while j <= n:
		if j == n or st[j] != char:
			change += lent // 2
			gh = gheir(st[j - 1]) if lent % 2 == 1 else gheir2(st[j - 1], st[j])
			num = 1
			for k in range(j - lent, j):
				if num % 2 == 0:
					ans += gh
				else:
					ans += st[k]
				num += 1
			break
		else:
			lent += 1
		j += 1
	i = j
print(change)
print(ans)


n = int(input())
s = str(input())
a = [i for i in s]
ans = 0
for i in range(1, n):
	if a[i] == a[i - 1]:
		ans += 1
		t = 'RGB'
		for j in t:
			if j not in a[i:i + 2]:
				a[i] = j
				break
print(ans)
print(''.join(a))


n = int(input())
s = input()
mask = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
ans = n
num = -1
for i in range(6):
	ai = 0
	for j in range(n):
		ai += s[j] != mask[i][j % 3]
	ans = min(ans, ai)
	if ans == ai:
		num = i
print(ans)
print(mask[num] * (n // 3) + mask[num][0] * (n % 3 > 0) + mask[num][1] * (n % 3 > 1))


from sys import stdin, stdout
import math
I = stdin.readline
n = int(I())
s = I().rstrip()
co = 0
co = co + 56546
co = co - 56546
co = (co + 10002) % 10002
ar = [s[0]]
for i in range(1, n):
	if s[i] == ar[-1]:
		co += 1
		if ar[-1] == 'R':
			if i != n - 1:
				if s[i + 1] == 'G':
					ar.append('B')
				else:
					ar.append('G')
			else:
				ar.append('G')
		elif ar[-1] == 'G':
			if i != n - 1:
				if s[i + 1] == 'B':
					ar.append('R')
				else:
					ar.append('B')
			else:
				ar.append('B')
		elif ar[-1] == 'B':
			if i != n - 1:
				if s[i + 1] == 'G':
					ar.append('R')
				else:
					ar.append('G')
			else:
				ar.append('G')
	else:
		ar.append(s[i])
print(co)
print(''.join(ar))


def main():
	n = int(input())
	s = input()
	char_dict = {'R': 0, 'G': 1, 'B': 2}
	color_map = ['R', 'G', 'B']
	dp = [[0] * 3 for _ in range(n)]
	prev = [[0] * 3 for _ in range(n)]
	for i in range(3):
		dp[0][i] = 1
		prev[0][i] = -1
	dp[0][char_dict[s[0]]] = 0
	for i in range(1, n):
		curr_index = char_dict[s[i]]
		for c in range(3):
			recolor_count = n + 1
			prev_color = -1
			for p in range(3):
				if c == p:
					continue
				if dp[i - 1][p] < recolor_count:
					recolor_count = dp[i - 1][p]
					prev_color = p
			if c != curr_index:
				dp[i][c] = recolor_count + 1
			else:
				dp[i][c] = recolor_count
			prev[i][c] = prev_color
	min_count = n + 1
	min_pos = -1
	for i in range(3):
		if dp[n - 1][i] < min_count:
			min_count = dp[n - 1][i]
			min_pos = i
	print(min_count)
	ret = ''
	for i in range(n - 1, -1, -1):
		ret += color_map[min_pos]
		min_pos = prev[i][min_pos]
	print(ret[::-1])
main()


def main():
	n = int(input())
	s = list(input())
	k = 'RGB'
	count = 0
	if n == 1:
		print(0)
		new = s[0]
		print(new)
		return
	for i in range(1, n - 1):
		prev = s[i - 1]
		curr = s[i]
		nex = s[i + 1]
		if prev == curr:
			for j in range(3):
				if k[j] != prev and k[j] != nex:
					s[i] = k[j]
					count += 1
					break
	new = ''
	if s[-1] == s[-2]:
		count += 1
		for j in range(3):
			if s[-2] != k[j]:
				s[-1] = k[j]
				break
	print(count)
	for i in s:
		new += i
	print(new)
main()


import math
n = int(input())
yo = int(math.ceil(n / 3))
s = input()
s = list(s)
fl = ['R', 'G', 'B'] * yo
sl = ['R', 'B', 'G'] * yo
tl = ['G', 'R', 'B'] * yo
cl = ['G', 'B', 'R'] * yo
pl = ['B', 'R', 'G'] * yo
chl = ['B', 'G', 'R'] * yo
fc = 0
sc = 0
tc = 0
cc = 0
pc = 0
chc = 0
for i in range(n):
	if fl[i] != s[i]:
		fc += 1
	if sl[i] != s[i]:
		sc += 1
	if tl[i] != s[i]:
		tc += 1
	if cl[i] != s[i]:
		cc += 1
	if pl[i] != s[i]:
		pc += 1
	if chl[i] != s[i]:
		chc += 1
zol = [fc, sc, tc, cc, pc, chc]
lol = min(zol)
ind = zol.index(lol)
if ind == 0:
	print(fc)
	fl = fl[:n]
	print(''.join(fl))
elif ind == 1:
	print(sc)
	sl = sl[:n]
	print(''.join(sl))
elif ind == 2:
	print(tc)
	tl = tl[:n]
	print(''.join(tl))
elif ind == 3:
	print(cc)
	cl = cl[:n]
	print(''.join(cl))
elif ind == 4:
	print(pc)
	pl = pl[:n]
	print(''.join(pl))
elif ind == 5:
	print(chc)
	chl = chl[:n]
	print(''.join(chl))


n = int(input())
s = input()
arr = [0] * n
for i in range(n):
	arr[i] = s[i]
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if arr[0] == arr[1]:
		print(1)
		if arr[0] == 'G':
			print('GR')
		elif arr[0] == 'B':
			print('GB')
		else:
			print('RG')
	else:
		print(0)
		print(s)
else:
	i = 0
	ct = 0
	while i < n - 1:
		j = i
		while j < n - 1 and arr[j] == arr[j + 1]:
			j += 1
		if j != i:
			k = i + 1
			while k <= j:
				if arr[k] == 'G':
					if k + 1 < n and arr[k + 1] != 'B':
						arr[k] = 'B'
					else:
						arr[k] = 'R'
				elif arr[k] == 'B':
					if k + 1 < n and arr[k + 1] != 'G':
						arr[k] = 'G'
					else:
						arr[k] = 'R'
				elif k + 1 < n and arr[k + 1] != 'B':
					arr[k] = 'B'
				else:
					arr[k] = 'G'
				ct += 1
				k += 2
			i = j - 1
		i += 1
	if arr[-1] == arr[-2]:
		if arr[k] == 'G':
			arr[k] = 'B'
		elif arr[k] == 'B':
			arr[k] = 'R'
		else:
			arr[k] = 'G'
		ct += 1
	print(ct)
	for i in range(n):
		print(arr[i], end='')
	print()


import sys

class Main:

	def __init__(self):
		self.buff = None
		self.index = 0

	def next(self):
		if self.buff is None or self.index == len(self.buff):
			self.buff = sys.stdin.readline().split()
			self.index = 0
		val = self.buff[self.index]
		self.index += 1
		return val

	def next_int(self):
		return int(self.next())

	def solve(self):
		n = self.next_int()
		ss = self.next()
		res = ''
		cst = n
		for i in range(0, 6):
			tcst = 0
			cc = 'RGB'
			if i == 1:
				cc = 'RBG'
			elif i == 2:
				cc = 'BRG'
			elif i == 3:
				cc = 'BGR'
			elif i == 4:
				cc = 'GBR'
			elif i == 5:
				cc = 'GRB'
			for j in range(0, n):
				if ss[j] != cc[j % 3]:
					tcst += 1
			if tcst < cst:
				cst = tcst
				res = cc * (n // 3)
				if n % 3 != 0:
					res += cc[:n % 3]
		print(cst)
		print(res)
Main().solve()


def compatible(prev, *args):
	if not args:
		return next(iter(colour_set - {prev}))
	else:
		return next(iter(colour_set - {prev, args[0]}))
n_lamps = int(input())
garland = list(input())
colour_set = {'R', 'G', 'B'}
count = 0
for (idx, lamp) in enumerate(garland):
	if idx == 0:
		continue
	prev = garland[idx - 1]
	if lamp == prev:
		if idx == len(garland) - 1:
			garland[-1] = compatible(prev)
			count += 1
			continue
		nxt = garland[idx + 1]
		garland[idx] = compatible(prev, nxt)
		count += 1
print(count)
print(''.join(garland))


n = int(input())
input_string = input()
res = 0
res_string = ''
i = 0
while i < n:
	if i + 1 < n:
		if input_string[i] == input_string[i + 1]:
			res_string = res_string + input_string[i]
			if i + 2 < n:
				if input_string[i] == 'R' and input_string[i + 2] == 'R':
					res_string += 'G'
				if input_string[i] == 'R' and input_string[i + 2] == 'B':
					res_string += 'G'
				if input_string[i] == 'R' and input_string[i + 2] == 'G':
					res_string += 'B'
				if input_string[i] == 'G' and input_string[i + 2] == 'G':
					res_string += 'R'
				if input_string[i] == 'G' and input_string[i + 2] == 'B':
					res_string += 'R'
				if input_string[i] == 'G' and input_string[i + 2] == 'R':
					res_string += 'B'
				if input_string[i] == 'B' and input_string[i + 2] == 'B':
					res_string += 'R'
				if input_string[i] == 'B' and input_string[i + 2] == 'G':
					res_string += 'R'
				if input_string[i] == 'B' and input_string[i + 2] == 'R':
					res_string += 'G'
			else:
				if input_string[i] == 'R':
					res_string += 'G'
				if input_string[i] == 'B':
					res_string += 'G'
				if input_string[i] == 'G':
					res_string += 'B'
			i += 1
			res += 1
		else:
			res_string = res_string + input_string[i]
	else:
		res_string = res_string + input_string[i]
	i += 1
print(res)
print(res_string)


a = int(input())
s = input()
ans = []
for i in range(len(s)):
	ans.append(s[i])
count = 0
for i in range(1, len(s)):
	if ans[i] != ans[i - 1]:
		continue
	if i == len(s) - 1:
		if ans[i] == ans[i - 1]:
			if ans[i - 1] == 'R':
				ans[i] = 'G'
			if ans[i - 1] == 'G':
				ans[i] = 'R'
			if ans[i - 1] == 'B':
				ans[i] = 'R'
			count += 1
			continue
	elif s[i - 1] == s[i + 1]:
		if ans[i - 1] == 'R':
			ans[i] = 'G'
		if s[i - 1] == 'G':
			ans[i] = 'R'
		if s[i - 1] == 'B':
			ans[i] = 'R'
		count += 1
		continue
	else:
		if ans[i - 1] == 'R' and ans[i + 1] == 'G' or (ans[i - 1] == 'G' and ans[i + 1] == 'R'):
			ans[i] = 'B'
		if ans[i - 1] == 'B' and ans[i + 1] == 'G' or (ans[i - 1] == 'G' and ans[i + 1] == 'B'):
			ans[i] = 'R'
		if ans[i - 1] == 'R' and ans[i + 1] == 'B' or (ans[i - 1] == 'B' and ans[i + 1] == 'R'):
			ans[i] = 'G'
		count += 1
		continue
print(count)
print(''.join(map(str, ans)))


n = int(input())
k = n // 3
xe = input().rstrip()
if k != 0:
	ft = 'RGB' * k
	st = 'RBG' * k
	tt = 'GRB' * k
	et = 'GBR' * k
	ot = 'BGR' * k
	rt = 'BRG' * k
	if n % 3 == 1:
		ft += ft[0]
		st += st[0]
		tt += tt[0]
		et += et[0]
		ot += ot[0]
		rt += rt[0]
	if n % 3 == 2:
		ft += ft[0:2]
		st += st[0:2]
		tt += tt[0:2]
		et += et[0:2]
		ot += ot[0:2]
		rt += rt[0:2]
	q = w = e = r = t = y = 0
	for i in range(n):
		if xe[i] != ft[i]:
			q += 1
		if xe[i] != st[i]:
			w += 1
		if xe[i] != tt[i]:
			e += 1
		if xe[i] != et[i]:
			r += 1
		if xe[i] != ot[i]:
			t += 1
		if xe[i] != rt[i]:
			y += 1
	if min(q, w, e, r, t, y) == q:
		print(q)
		print(ft)
	elif min(q, w, e, r, t, y) == w:
		print(w)
		print(st)
	elif min(q, w, e, r, t, y) == e:
		print(e)
		print(tt)
	elif min(q, w, e, r, t, y) == r:
		print(r)
		print(et)
	elif min(q, w, e, r, t, y) == t:
		print(t)
		print(ot)
	elif min(q, w, e, r, t, y) == y:
		print(y)
		print(rt)
else:
	if n == 1:
		print('0')
		print(xe)
	if n == 2:
		if xe[0] != xe[1]:
			print('0')
			print(xe)
		else:
			if xe == 'RR':
				print('1')
				print('RG')
			if xe == 'GG':
				print('1')
				print('RG')
			if xe == 'BB':
				print('1')
				print('BG')


import sys
from itertools import permutations

def perebor(s, stroka):
	count = 0
	s2 = list(s)
	for l in range(len(stroka)):
		if s2[l] != stroka[l]:
			count += 1
			s2[l] = stroka[l]
	for ind in range(len(stroka), len(s)):
		if s2[ind] != s2[ind - 3]:
			s2[ind] = s2[ind - 3]
			count += 1
	return (s2, count)
n = int(input())
s = list(input())
count = 0
if n < 3:
	if n == 1:
		print(0)
		print(''.join(s))
		sys.exit(0)
	else:
		p = []
		pos = ['RG', 'GR', 'RB', 'BR', 'GB', 'BG']
		for pa in pos:
			p = p + list(permutations(pa))
else:
	p = permutations('RGB')
count_best = 9999999
s_best = 99999999
for l in p:
	(s1, count1) = perebor(s, l)
	if count1 < count_best:
		s_best = s1
		count_best = count1
print(count_best)
print(''.join(s_best))


n = int(input())
s = input()
c = 2 * 10 ** 5 // 2
ls = ['RGB' * c, 'RBG' * c, 'GRB' * c, 'BGR' * c, 'GBR' * c, 'BRG' * c]
m = 2 * 10 ** 5
for i in range(6):
	count = 0
	for k in range(n):
		if s[k] != ls[i][k]:
			count += 1
	if count <= m:
		ans = ls[i][:n]
	m = min(count, m)
print(m)
print(ans)


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


input()
garor = list(input())
gar = garor.copy()
for i in range(1, len(gar)):
	if gar[i] == gar[i - 1]:
		options = ['R', 'G', 'B']
		options.remove(gar[i - 1])
		if i < len(gar) - 1 and gar[i + 1] in options:
			options.remove(gar[i + 1])
		gar[i] = options[0]
count = 0
for i in range(0, len(gar)):
	if gar[i] != garor[i]:
		count = count + 1
print(count)
str1 = ''.join(gar)
print(str1)


def othercolor(v, j):
	C = set(['R', 'G', 'B'])
	v2 = Color[(j + 1) % N]
	C.remove(v)
	if v != v2:
		C.remove(v2)
	return list(C)[0]
N = int(input())
Color = input()
pre = ''
ans = 0
Ans = ''
C = set(['R', 'G', 'B'])
for (i, c) in enumerate(Color):
	if pre == c:
		ans += 1
		cn = othercolor(c, i)
		Ans += cn
		pre = cn
	else:
		Ans += c
		pre = c
print(ans)
print(Ans)


n = int(input())
s = ['RGB', 'RBG', 'BGR', 'BRG', 'GBR', 'GRB']
a = input()
m = 10 ** 9
for i in range(6):
	c = 0
	s1 = s[i] * (n // 3) + s[i][:n % 3]
	for j in range(n):
		if a[j] != s1[j]:
			c += 1
	if c < m:
		m = c
		ans = s1
print(m)
print(ans)


def f(s):
	s = list(s)
	ans = 0
	for i in range(0, len(s) - 3):
		if s[i] == s[i + 1] == s[i + 2]:
			for sub in 'RGB':
				if sub != s[i]:
					s[i + 1] = sub
					ans += 1
					break
		elif s[i] == s[i + 1]:
			for sub in 'RGB':
				if sub != s[i + 2] and sub != s[i]:
					s[i + 1] = sub
					ans += 1
					break
	if len(s) >= 3:
		if s[-3] == s[-2] == s[-1]:
			for sub in 'RGB':
				if sub != s[-1]:
					s[-2] = sub
					ans += 1
					break
		if s[-3] == s[-2]:
			for sub in 'RGB':
				if sub != s[-2] and sub != s[-1]:
					s[-2] = sub
					ans += 1
					break
	if len(s) >= 2:
		if s[-2] == s[-1]:
			for sub in 'RGB':
				if sub != s[-2]:
					s[-1] = sub
					ans += 1
					break
	print(ans)
	return ''.join(s)
a = input()
s = input()
print(f(s))


N = int(input())
s = input()
res = [s[0]]
count = 0
colors = ['R', 'G', 'B']
i = 0
if N == 1:
	print(count)
	print(s)
	exit(0)
if N > 2:
	for i in range(1, N - 1):
		if s[i] == res[i - 1]:
			sub = [c for c in colors if c != res[i - 1] and c != s[i + 1]]
			res.append(sub[0])
			count += 1
		else:
			res.append(s[i])
i += 1
if s[i] == res[i - 1]:
	sub = [c for c in colors if c != res[i - 1]]
	res.append(sub[0])
	count += 1
else:
	res.append(s[i])
print(count)
print(''.join(res))


n = int(input())
s = input()
s = list(s)
l = n
a = []
t = 0
q = []
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'R':
			t = t + 1
		q.append('R')
	elif i % 3 == 1:
		if s[i] != 'G':
			t = t + 1
		q.append('G')
	elif i % 3 == 2:
		if s[i] != 'B':
			t = t + 1
		q.append('B')
if t < l:
	l = t
	a = q
t = 0
q = []
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'R':
			t = t + 1
		q.append('R')
	elif i % 3 == 1:
		if s[i] != 'B':
			t = t + 1
		q.append('B')
	elif i % 3 == 2:
		if s[i] != 'G':
			t = t + 1
		q.append('G')
if t < l:
	l = t
	a = q
t = 0
q = []
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'G':
			t = t + 1
		q.append('G')
	elif i % 3 == 1:
		if s[i] != 'R':
			t = t + 1
		q.append('R')
	elif i % 3 == 2:
		if s[i] != 'B':
			t = t + 1
		q.append('B')
if t < l:
	l = t
	a = q
t = 0
q = []
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'G':
			t = t + 1
		q.append('G')
	elif i % 3 == 1:
		if s[i] != 'B':
			t = t + 1
		q.append('B')
	elif i % 3 == 2:
		if s[i] != 'R':
			t = t + 1
		q.append('R')
if t < l:
	l = t
	a = q
t = 0
q = []
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'B':
			t = t + 1
		q.append('B')
	elif i % 3 == 1:
		if s[i] != 'R':
			t = t + 1
		q.append('R')
	elif i % 3 == 2:
		if s[i] != 'G':
			t = t + 1
		q.append('G')
if t < l:
	l = t
	a = q
t = 0
q = []
for i in range(n):
	if i % 3 == 0:
		if s[i] != 'B':
			t = t + 1
		q.append('B')
	elif i % 3 == 1:
		if s[i] != 'G':
			t = t + 1
		q.append('G')
	elif i % 3 == 2:
		if s[i] != 'R':
			t = t + 1
		q.append('R')
if t < l:
	l = t
	a = q
print(l)
a = ''.join(a)
print(a)


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve(n, m):
	if n >= m:
		return n - m
	if m % 2:
		return 1 + solve(n, m + 1)
	return 1 + solve(n, m // 2)

def main():
	n = get_int()
	st = list(input())
	m = 0
	for i in range(1, n):
		if st[i] == st[i - 1]:
			m += 1
			st[i] = (set('RGB') - set(st[i:i + 2])).pop()
	print(m)
	print(''.join(st))
TestCases = False
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


import math
import sys
input = sys.stdin.readline
n = int(input())
s = input()
c = 0
a = [s[0]]
k = ['R', 'G', 'B']
if n == 1:
	print(0)
	print(s)
	exit()
for i in range(1, n - 1):
	if s[i] == a[-1]:
		for j in k:
			if j != s[i + 1] and j != a[-1]:
				a.append(j)
				break
		c += 1
	else:
		a.append(s[i])
if a[-1] == s[n - 1]:
	for j in k:
		if j != a[-1]:
			a.append(j)
			break
	c += 1
else:
	a.append(s[n - 1])
print(c)
print(''.join(a))


n = int(input())
garland = input()
colors = ['R', 'G', 'B']
result = ''
count = 0
index = 0
while index < n:
	result += garland[index]
	if index + 1 < n and garland[index] == garland[index + 1]:
		temp = colors.copy()
		temp.remove(garland[index])
		if index + 2 < n and garland[index] != garland[index + 2]:
			temp.remove(garland[index + 2])
		result += temp[0]
		count += 1
		index += 1
	index += 1
print(count, result, sep='\n')


from itertools import permutations
n = int(input())
lamps = input().strip()
per = list(permutations('RGB'))
counts = [0] * 6
for (i, l) in enumerate(lamps):
	for j in range(6):
		counts[j] += 0 if per[j][i % 3] == l else 1
re = min(counts)
for (i, co) in enumerate(counts):
	if co == re:
		resp = per[i] * (2 + n // 3)
		break
print(re)
print(''.join(resp)[:n])


import sys
n = int(input())
s = input()
d = ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR']
ans = [0] * 6
for j in range(6):
	for i in range(n):
		if d[j][i % 3] != s[i]:
			ans[j] += 1
mini = sys.maxsize
index = -1
for i in range(6):
	if mini > ans[i]:
		mini = ans[i]
		index = i
print(mini)
print(d[index] * ((n - n % 3) // 3) + d[index][0:n % 3])


def D():
	n = int(input())
	s = input()
	colours = ['B', 'G', 'R']
	ans = ''
	i = 0
	c = []
	cnt = 1
	while i < n - 1:
		if s[i + 1] == s[i]:
			cnt += 1
		else:
			c.append(cnt)
			cnt = 1
		i += 1
	c.append(cnt)
	i = 0
	counter = 0
	for e in c:
		if e == 1:
			ans += s[i]
			i += 1
		else:
			counter += e // 2
			for j in range(e):
				if j % 2:
					if i == n - 1:
						ans += colours[(colours.index(s[i - 1]) + 1) % 3]
					elif s[i + 1] == s[i]:
						ans += colours[(colours.index(s[i + 1]) + 1) % 3]
					else:
						ans += colours[3 - colours.index(s[i - 1]) - colours.index(s[i + 1])]
				else:
					ans += s[i]
				i += 1
	print(counter)
	print(ans)
D()


import math
n = int(input())
s = input()
l = ['RBG', 'RGB', 'GRB', 'GBR', 'BGR', 'BRG']
min_l = 10000000
min_str = ''
for p in l:
	res = 0
	for i in range(len(s)):
		if s[i] != p[i % 3]:
			res += 1
	if res < min_l:
		min_l = res
		min_str = p
res = ''
for i in range(len(s) // 3 + 1):
	res += min_str
print(min_l)
print(res[:len(s)])


import copy
import itertools
import string
import sys

def powmod(x, p, m):
	if p <= 0:
		return 1
	if p <= 1:
		return x % m
	return powmod(x * x % m, p // 2, m) * (x % m) ** (p % 2) % m

def to_basex(num, x):
	while num > 0:
		yield (num % x)
		num //= x

def from_basex(it, x):
	ret = 0
	p = 1
	for d in it:
		ret += d * p
		p *= x
	return ret

def core():
	n = int(input())
	s = input()
	pattern = 'RGB' * 10 ** 5
	revpat = 'BGR' * 10 ** 5
	cost = 10 ** 6
	for cand in [pattern[0:n], pattern[1:n + 1], pattern[2:n + 2], revpat[0:n], revpat[1:n + 1], revpat[2:n + 2]]:
		candcost = 0
		for i in range(n):
			if s[i] != cand[i]:
				candcost += 1
		if candcost < cost:
			cost = candcost
			ans = cand
	print(cost)
	print(ans)
core()


input()
s = input()

def cost(p, s):
	return sum((1 for (i, x) in enumerate(p) if len(s) - 1 >= i and x != s[i]))

def solve(s):
	ss = set(['R', 'G', 'B'])
	ls = list(s)
	cnt = 0
	current = ls[0]
	for (i, x) in enumerate(ls[1:], 1):
		if current == x:
			ns = set([ls[i], ls[i - 1]])
			if i + 1 < len(s):
				ns.add(ls[i + 1])
			ls[i] = (ss - ns).pop()
			cnt += 1
		current = ls[i]
	return (cnt, ''.join(ls))
ans = solve(s)
print(ans[0], ans[1])


(z, s, x) = (int(input()), [*input(), 0], 0)
for i in range(1, z):
	if s[i] == s[i - 1]:
		x += 1
		s[i] = (set('RGB') - set(s[i:i + 2])).pop()
print(x, ''.join(s[:-1]))


import sys
from atexit import register
from io import FileIO, StringIO
sys.stdin = StringIO(FileIO(0).read().decode())
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.stdout = StringIO()
register(lambda : FileIO(1, 'w').write(sys.stdout.getvalue().encode()))

def main():
	n = int(input())
	s = list(input())
	base_cases = map(list, ['RGB', 'RBG', 'GRB', 'GBR', 'BRG', 'BGR'])
	ans = float('inf')
	for case in base_cases:
		full_case = case * (n // 3) + case[:n % 3]
		cnt = 0
		for i in range(n):
			if full_case[i] != s[i]:
				cnt += 1
		if cnt < ans:
			ans = cnt
			res = full_case
	print(ans)
	print(''.join(res))
main()


def is_diverse(left, mid):
	return left != mid

def diverse_lamp_color(left, right=None):
	init_set = set(['R', 'G', 'B'])
	return init_set.difference(set([left, right])).pop()

def diverse_gardland(lamps):
	lamps = list(lamps)
	count = 0
	for i in range(1, len(lamps)):
		if not is_diverse(lamps[i - 1], lamps[i]):
			if i == len(lamps) - 1:
				lamps[i] = diverse_lamp_color(lamps[i - 1])
			else:
				lamps[i] = diverse_lamp_color(lamps[i - 1], lamps[i + 1])
			count += 1
	return (''.join(lamps), count)
n = int(input())
lamps = input()
(lamps, count) = diverse_gardland(lamps)
print(count)
print(lamps)


n = int(input())
s = str(input())
ans = 0
l = list(s)
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if l[0] != l[1]:
		print(0)
		print(s)
	elif l[0] == l[1]:
		if l[0] == 'R':
			print(1)
			print('GR')
		elif l[0] == 'G':
			print(1)
			print('RG')
		elif l[0] == 'B':
			print(1)
			print('GB')
else:
	for i in range(n - 2):
		if l[i] == l[i + 1] and l[i + 1] == l[i + 2]:
			if l[i + 1] == 'R':
				l[i + 1] = 'G'
				ans += 1
			elif l[i + 1] == 'G':
				l[i + 1] = 'B'
				ans += 1
			elif l[i + 1] == 'B':
				l[i + 1] = 'R'
				ans += 1
		elif l[i] == l[i + 1]:
			if l[i + 1] == 'R':
				if l[i + 2] == 'G':
					l[i + 1] = 'B'
					ans += 1
				elif l[i + 2] == 'B':
					l[i + 1] = 'G'
					ans += 1
			elif l[i + 1] == 'G':
				if l[i + 2] == 'R':
					l[i + 1] = 'B'
					ans += 1
				elif l[i + 2] == 'B':
					l[i + 1] = 'R'
					ans += 1
			elif l[i + 1] == 'B':
				if l[i + 2] == 'G':
					l[i + 1] = 'R'
					ans += 1
				elif l[i + 2] == 'R':
					l[i + 1] = 'G'
					ans += 1
	if l[n - 1] == l[n - 2]:
		if l[n - 1] == 'R':
			ans += 1
			l[n - 1] = 'G'
		elif l[n - 1] == 'G':
			ans += 1
			l[n - 1] = 'B'
		elif l[n - 1] == 'B':
			l[n - 1] = 'R'
			ans += 1
	print(ans)
	for i in l:
		print(i, end='')
	print()


n1 = int(input())
x = 0
a = list(input())
for i in range(1, n1 - 1):
	if a[i - 1] == a[i]:
		n = {'R', 'G', 'B'}
		n.discard(a[i - 1])
		n.discard(a[i + 1])
		a[i] = n.pop()
		x += 1
if n1 > 1:
	if a[-1] == a[-2]:
		n = {'R', 'G', 'B'}
		n.discard(a[-2])
		a[-1] = n.pop()
		x += 1
print(x)
print(''.join(a))


import sys
n = int(input())
inp = list(input())
ans = 0
if n == 1:
	print(0)
	print(''.join(inp))
	sys.exit()
if n == 2:
	if inp[0] == inp[1]:
		if inp[1] == 'R' or inp[1] == 'G':
			inp[0] = 'B'
		else:
			inp[0] = 'R'
		ans = 1
	print(ans)
	print(''.join(inp))
	sys.exit()
for i in range(2, n):
	if inp[i - 2] == inp[i - 1] and inp[i - 1] == inp[i]:
		if inp[i] == 'R' or inp[i] == 'B':
			inp[i - 1] = 'G'
		else:
			inp[i - 1] = 'R'
		ans += 1
for i in range(2, n):
	if inp[i - 1] == inp[i]:
		if (inp[i - 2] == 'R' or inp[i - 2] == 'G') and (inp[i] == 'R' or inp[i] == 'G'):
			inp[i - 1] = 'B'
		elif (inp[i - 2] == 'R' or inp[i - 2] == 'B') and (inp[i] == 'R' or inp[i] == 'B'):
			inp[i - 1] = 'G'
		elif (inp[i - 2] == 'G' or inp[i - 2] == 'B') and (inp[i] == 'G' or inp[i] == 'B'):
			inp[i - 1] = 'R'
		ans += 1
if inp[0] == inp[1]:
	if inp[1] == 'R' or inp[1] == 'B':
		inp[0] = 'G'
	else:
		inp[0] = 'R'
	ans += 1
print(ans)
print(''.join(inp))


rgb = {'R', 'G', 'B'}
n = int(input())
gir = list(input())
recolorings = 0
if n > 1:
	for i in range(1, len(gir) - 1):
		if gir[i] == gir[i - 1]:
			gir[i] = (rgb - set(gir[i]) - set(gir[i + 1])).pop()
			recolorings += 1
	if gir[-2] == gir[-1]:
		gir[-1] = (rgb - set(gir[-1])).pop()
		recolorings += 1
print(recolorings)
print(''.join(gir))


n = int(input())
arr = [i for i in input()]

def give_me_color(col1, col2):
	cols = ['R', 'G', 'B']
	if col2 == 'bb' or col1 == col2:
		x = cols.index(col1)
		ans = cols[(x + 1) % 3]
		return ans
	if col1 == 'R' and col2 == 'G' or (col2 == 'R' and col1 == 'G'):
		return 'B'
	if col1 == 'R' and col2 == 'B' or (col2 == 'R' and col1 == 'B'):
		return 'G'
	if col1 == 'B' and col2 == 'G' or (col2 == 'B' and col1 == 'G'):
		return 'R'
count = 0
for i in range(n - 1):
	if arr[i] == arr[i + 1]:
		if i == n - 2:
			arr[i + 1] = give_me_color(arr[i], 'bb')
		else:
			arr[i + 1] = give_me_color(arr[i], arr[i + 2])
		count += 1
print(count)
print(''.join(arr))


def calculate(str1, str2):
	count = 0
	for i in range(len(str1)):
		char1 = str1[i]
		char2 = str2[i]
		if char1 != char2:
			count += 1
	return count

def solve(size, string):
	if size == 1:
		return (0, string)
	elif size == 2:
		if string[0] != string[1]:
			return (0, string)
		if string[0] == 'R' or string[0] == 'G':
			return (1, 'B' + string[1])
		else:
			return (1, 'R' + string[1])
	div3 = size // 3
	mod3 = size % 3
	options = []
	options.append('RGB' * div3 + 'RGB'[:mod3])
	options.append('RBG' * div3 + 'RBG'[:mod3])
	options.append('GRB' * div3 + 'GRB'[:mod3])
	options.append('GBR' * div3 + 'GBR'[:mod3])
	options.append('BGR' * div3 + 'BGR'[:mod3])
	options.append('BRG' * div3 + 'BRG'[:mod3])
	min_weight = float('inf')
	min_option = ''
	for option in options:
		weight = calculate(option, string)
		if weight < min_weight:
			min_weight = weight
			min_option = option
	return (min_weight, min_option)
size = int(input())
string = input().rstrip('\r\n')
(solution_weight, solution) = solve(size, string)
print(solution_weight)
print(solution)


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])


n = int(input())
s = input()
s = [i for i in s]
ans = 0
e = ['R', 'G', 'B']
for i in range(1, n):
	if s[i] == s[i - 1]:
		ans += 1
		dame = set()
		dame.add(e.index(s[i - 1]))
		if i != n - 1:
			dame.add(e.index(s[i + 1]))
		for j in range(3):
			if j in dame:
				continue
			else:
				s[i] = e[j]
				break
print(ans)
print(''.join(s))


n = int(input())
l = list(input())
ans = []
if len(l) == 2:
	if l[0] == 'R' and l[1] == l[0]:
		print(1)
		print('RB')
	if l[0] == 'B' and l[1] == l[0]:
		print(1)
		print('RB')
	if l[0] == 'G' and l[1] == l[0]:
		print(1)
		print('GR')
	if l[0] != l[1]:
		print(0)
		print(''.join(l))
	exit()
if len(l) == 1:
	print(0)
	print(l[0])
	exit()
for z in range(3):
	for k in range(2):
		tmp1 = []
		tmp2 = []
		tmp3 = []
		if z == 0 and k == 0:
			for i in range(n):
				if i % 3 == 0 and l[i] != 'R':
					tmp1.append(i)
				if i % 3 == 1 and l[i] != 'G':
					tmp2.append(i)
				if i % 3 == 2 and l[i] != 'B':
					tmp3.append(i)
		if z == 0 and k == 1:
			for i in range(n):
				if i % 3 == 0 and l[i] != 'R':
					tmp1.append(i)
				if i % 3 == 2 and l[i] != 'G':
					tmp2.append(i)
				if i % 3 == 1 and l[i] != 'B':
					tmp3.append(i)
		if z == 1 and k == 0:
			for i in range(n):
				if i % 3 == 1 and l[i] != 'R':
					tmp1.append(i)
				if i % 3 == 0 and l[i] != 'G':
					tmp2.append(i)
				if i % 3 == 2 and l[i] != 'B':
					tmp3.append(i)
		if z == 1 and k == 1:
			for i in range(n):
				if i % 3 == 1 and l[i] != 'R':
					tmp1.append(i)
				if i % 3 == 2 and l[i] != 'G':
					tmp2.append(i)
				if i % 3 == 0 and l[i] != 'B':
					tmp3.append(i)
		if z == 2 and k == 0:
			for i in range(n):
				if i % 3 == 2 and l[i] != 'R':
					tmp1.append(i)
				if i % 3 == 0 and l[i] != 'G':
					tmp2.append(i)
				if i % 3 == 1 and l[i] != 'B':
					tmp3.append(i)
		if z == 2 and k == 1:
			for i in range(n):
				if i % 3 == 2 and l[i] != 'R':
					tmp1.append(i)
				if i % 3 == 1 and l[i] != 'G':
					tmp2.append(i)
				if i % 3 == 0 and l[i] != 'B':
					tmp3.append(i)
		ans.append([tmp1, tmp2, tmp3])
m = 0
for i in range(len(ans)):
	if len(ans[i][0]) + len(ans[i][1]) + len(ans[i][2]) < len(ans[m][0]) + len(ans[m][1]) + len(ans[m][2]):
		m = i
for i in ans[m][0]:
	l[i] = 'R'
for i in ans[m][1]:
	l[i] = 'G'
for i in ans[m][2]:
	l[i] = 'B'
print(len(ans[m][0]) + len(ans[m][1]) + len(ans[m][2]))
print(''.join(l))


n = int(input())
s = list(input())
r = n // 3 + 1
rgb = list(list('RGB') * r)
rbg = list(list('RBG') * r)
grb = list(list('GRB') * r)
gbr = list(list('GBR') * r)
bgr = list(list('BGR') * r)
brg = list(list('BRG') * r)
minn = 200005
rgb_diff = 0
for i in range(len(s)):
	if s[i] != rgb[i]:
		rgb_diff += 1
if rgb_diff <= minn:
	minn = rgb_diff
	ans = rgb
rbg_diff = 0
for i in range(len(s)):
	if s[i] != rbg[i]:
		rbg_diff += 1
if rbg_diff <= minn:
	minn = rbg_diff
	ans = rbg
grb_diff = 0
for i in range(len(s)):
	if s[i] != grb[i]:
		grb_diff += 1
if grb_diff <= minn:
	minn = grb_diff
	ans = grb
gbr_diff = 0
for i in range(len(s)):
	if s[i] != gbr[i]:
		gbr_diff += 1
if gbr_diff <= minn:
	minn = gbr_diff
	ans = gbr
bgr_diff = 0
for i in range(len(s)):
	if s[i] != bgr[i]:
		bgr_diff += 1
if bgr_diff <= minn:
	minn = bgr_diff
	ans = bgr
brg_diff = 0
for i in range(len(s)):
	if s[i] != brg[i]:
		brg_diff += 1
if brg_diff <= minn:
	minn = brg_diff
	ans = brg
ans = ans[:len(s)]
print(minn)
for i in ans:
	print(i, end='')


n = int(input())
l = input()
a = list(l)
count = 0
chk = ['R', 'G', 'B']
if len(l) <= 1:
	print(0)
	print(l[0])
else:
	for i in range(len(l) - 2):
		if a[i] == a[i + 1]:
			if a[i + 2] == a[i]:
				count += 1
				if a[i] == 'R':
					a[i + 1] = 'G'
				if a[i] == 'G':
					a[i + 1] = 'B'
				if a[i] == 'B':
					a[i + 1] = 'R'
			else:
				count += 1
				if a[i] == 'R' and a[i + 2] == 'G':
					a[i + 1] = 'B'
				if a[i] == 'G' and a[i + 2] == 'R':
					a[i + 1] = 'B'
				if a[i] == 'B' and a[i + 2] == 'G':
					a[i + 1] = 'R'
				if a[i] == 'G' and a[i + 2] == 'B':
					a[i + 1] = 'R'
				if a[i] == 'R' and a[i + 2] == 'B':
					a[i + 1] = 'G'
				if a[i] == 'B' and a[i + 2] == 'R':
					a[i + 1] = 'G'
	if a[-1] == 'R' and a[-2] == 'R':
		count += 1
		a[-1] = 'G'
	if a[-1] == 'G' and a[-2] == 'G':
		count += 1
		a[-1] = 'B'
	if a[-1] == 'B' and a[-2] == 'B':
		count += 1
		a[-1] = 'R'
	print(count)
	s = ''
	for i in a:
		s += i
	print(s)


n = int(input())
s = str(input())
s1 = 'RGB' * (n // 3)
s2 = 'RBG' * (n // 3)
s3 = 'GBR' * (n // 3)
s4 = 'GRB' * (n // 3)
s5 = 'BRG' * (n // 3)
s6 = 'BGR' * (n // 3)
d = n % 3
(m1, m2, m3, m4, m5, m6) = (0, 0, 0, 0, 0, 0)
m = [0, 0, 0, 0, 0, 0]
if d == 1:
	s1 += 'R'
	s2 += 'R'
	s3 += 'G'
	s4 += 'G'
	s5 += 'B'
	s6 += 'B'
if d == 2:
	s1 += 'RG'
	s2 += 'RB'
	s3 += 'GB'
	s4 += 'GR'
	s5 += 'BR'
	s6 += 'BG'
ans = [s1, s2, s3, s4, s5, s6]
for i in range(n):
	if s[i] != s1[i]:
		m1 += 1
		m[0] += 1
	if s[i] != s2[i]:
		m2 += 1
		m[1] += 1
	if s[i] != s3[i]:
		m3 += 1
		m[2] += 1
	if s[i] != s4[i]:
		m4 += 1
		m[3] += 1
	if s[i] != s5[i]:
		m5 += 1
		m[4] += 1
	if s[i] != s6[i]:
		m6 += 1
		m[5] += 1
t = min(m1, m2, m3, m4, m5, m6)
k = m.index(t)
print(t)
print(ans[k])


import sys
input = sys.stdin.readline
n = int(input())
s = list(input().strip())
count = 0
for i in range(1, n):
	ref = {'R', 'G', 'B'}
	if s[i] == s[i - 1]:
		ref -= set(s[i])
		if i != n - 1:
			if s[i] != s[i + 1]:
				ref -= set(s[i + 1])
			for j in ref:
				s[i] = j
				count += 1
				break
		else:
			for j in ref:
				s[i] = j
				count += 1
				break
print(count)
print(''.join(s))


dict = {'R': 0, 'B': 0, 'G': 0}
n = int(input())
a = list(input())
count = 0
for i in range(1, n - 1):
	if a[i] == a[i - 1]:
		dict[a[i - 1]] = 1
		dict[a[i + 1]] = 1
		for j in dict.keys():
			if dict[j] == 0:
				a[i] = j
				break
		count += 1
		dict[a[i - 1]] = 0
		dict[a[i + 1]] = 0
if n >= 2:
	if a[n - 1] == a[n - 2]:
		count += 1
		for j in dict.keys():
			if j != a[n - 1]:
				a[n - 1] = j
				break
print(count)
ans = ''
for i in a:
	ans += i
print(ans)


n = int(input())
a = list(input())
k = 0
if len(a) == 1:
	print(0)
	print(''.join(a))
	exit()
for i in range(1, n - 1):
	if a[i] == a[i - 1]:
		if a[i + 1] == a[i]:
			if a[i] == 'B':
				a[i] = 'G'
			elif a[i] == 'R':
				a[i] = 'G'
			else:
				a[i] = 'R'
			k += 1
		else:
			if a[i - 1] == 'G':
				if a[i + 1] == 'R':
					a[i] = 'B'
				else:
					a[i] = 'R'
			elif a[i - 1] == 'R':
				if a[i + 1] == 'G':
					a[i] = 'B'
				else:
					a[i] = 'G'
			elif a[i - 1] == 'B':
				if a[i + 1] == 'R':
					a[i] = 'G'
				else:
					a[i] = 'R'
			k += 1
if a[-1] == a[-2]:
	k += 1
	if a[-2] == 'G':
		a[-1] = 'R'
	elif a[-2] == 'R':
		a[-1] = 'G'
	else:
		a[-1] = 'R'
print(k)
print(''.join(a))


input()
data = input()
prev = data[0]
slices = []
in_slice = None
subst = {'R': 'G', 'G': 'B', 'B': 'R'}
for (i, c) in enumerate(data[1:]):
	if in_slice is None:
		if c == prev:
			in_slice = i
	elif c != prev:
		slices.append((in_slice, i + 1))
		in_slice = None
	prev = c
if not in_slice is None:
	slices.append((in_slice, len(data)))
n = sum([(t - f) // 2 for (f, t) in slices])
print(n)
chars = list(data)
for (f, t) in slices:
	for i in range(f + (t - f) % 2, t, 2):
		chars[i] = subst[chars[i]]
	if (t - f) % 2 == 0 and f > 0 and (chars[f] == chars[f - 1]):
		chars[f] = subst[chars[f]]
print(''.join(chars))


def findColorChange(n, s, idx):
	cnt = 0
	for i in range(n):
		if s[i] == 'R' and i % 3 != idx[0]:
			cnt += 1
		if s[i] == 'G' and i % 3 != idx[1]:
			cnt += 1
		if s[i] == 'B' and i % 3 != idx[2]:
			cnt += 1
	return cnt
n = int(input())
s = input()
cnt = 0
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if s[0] == s[1]:
		print(1)
		print('R' + s[1] if s[0] != 'R' else 'G' + s[1] if s[1] != 'G' else 'B' + s[1])
	else:
		print(0)
		print(s)
else:
	idx = [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]]
	min_val = None
	min_idx = None
	for i in range(len(idx)):
		cnt = findColorChange(n, s, idx[i])
		if min_val == None or cnt < min_val:
			min_val = cnt
			min_idx = idx[i]
	print(min_val)
	if min_val == 0:
		print(s)
	else:
		new_s = ''
		for i in range(n):
			if s[i] == 'R':
				if i % 3 != min_idx[0]:
					new_s += 'G' if i % 3 == min_idx[1] else 'B'
				else:
					new_s += 'R'
			if s[i] == 'G':
				if i % 3 != min_idx[1]:
					new_s += 'R' if i % 3 == min_idx[0] else 'B'
				else:
					new_s += 'G'
			if s[i] == 'B':
				if i % 3 != min_idx[2]:
					new_s += 'R' if i % 3 == min_idx[0] else 'G'
				else:
					new_s += 'B'
		print(new_s)


n = int(input())
ls = input()
sol = []
s = 0
for c in ls:
	sol.append(c)
for i in range(1, len(ls) - 1):
	colors = ['G', 'R', 'B']
	if sol[i] == sol[i - 1]:
		cp = sol[i - 1]
		cd = sol[i + 1]
		try:
			colors.remove(cp)
			colors.remove(cd)
		except ValueError:
			pass
		s += 1
		newc = colors.pop()
		sol[i] = newc
if len(sol) > 1:
	if sol[len(sol) - 1] == sol[len(sol) - 2]:
		s += 1
		if sol[len(sol) - 2] == 'G':
			sol[len(sol) - 1] = 'R'
		else:
			sol[len(sol) - 1] = 'G'
print(s)
print(''.join(sol))


import math
permutation = [['R', 'G', 'B'], ['R', 'B', 'G'], ['G', 'B', 'R'], ['G', 'R', 'B'], ['B', 'G', 'R'], ['B', 'R', 'G']]
contadores = [0, 0, 0, 0, 0, 0]
i = int(input())
melhor = i + 1
menor = -1
s = input()
garden = list(s)
for a in range(0, 6):
	str = permutation[a]
	for b in range(0, i):
		if garden[b] != permutation[a][b % 3]:
			contadores[a] += 1
for a in range(0, 6):
	if contadores[a] <= melhor:
		melhor = contadores[a]
		menor = a
print(melhor)
for x in range(0, i):
	if garden[x] != permutation[menor][x % 3]:
		garden[x] = permutation[menor][x % 3]
s = ''.join(garden)
print(s)


n = int(input())
lamps = list(input())
count = 0
dict1 = {'R': 0, 'G': 1, 'B': 2}
dict2 = {1: 'B', 2: 'G', 3: 'R'}
i = 1
while i < n:
	if i == n - 1 and lamps[i] == lamps[i - 1]:
		count += 1
		if lamps[i] == 'R' or lamps[i] == 'B':
			lamps[i] = 'G'
		else:
			lamps[i] = 'R'
	elif lamps[i] == lamps[i - 1] == lamps[i + 1]:
		count += 1
		if lamps[i] == 'R' or lamps[i] == 'B':
			lamps[i] = 'G'
		else:
			lamps[i] = 'R'
	elif lamps[i] == lamps[i - 1]:
		count += 1
		lamps[i] = dict2[dict1[lamps[i]] + dict1[lamps[i + 1]]]
	i += 1
print(count)
print(''.join(lamps))


(lambda l, s, n: [[n[0].__setitem__(i % 3, n[0][i % 3] + 1) if s[i] == 'R' else n[1].__setitem__(i % 3, n[1][i % 3] + 1) if s[i] == 'G' else n[2].__setitem__(i % 3, n[2][i % 3] + 1) for i in range(l)], (lambda m: print(m[0], '012'.replace(str(m[1][0]), 'R').replace(str(m[1][1]), 'G').replace(str(m[1][2]), 'B') * (l // 3) + '012'.replace(str(m[1][0]), 'R').replace(str(m[1][1]), 'G').replace(str(m[1][2]), 'B')[:l % 3], sep='\n'))(min(([l - n[0][k[0]] - n[1][k[1]] - n[2][k[2]], k] for k in __import__('itertools').permutations(range(3)))))])(int(input()), input(), [[0] * 3 for i in '1' * 3])


n = int(input())
s = list(input())
res = 0
s1 = 'RG'
s2 = 'RB'
s3 = 'BG'
if n == 1:
	print(0)
	print(''.join(s))
	exit()
for i in range(n - 2):
	if s[i] == s[i + 1]:
		res += 1
		if s[i] == s[i + 2]:
			if s[i] == 'R' or s[i] == 'G':
				s[i + 1] = 'B'
			else:
				s[i + 1] = 'R'
		elif s[i] in s1 and s[i + 2] in s1:
			s[i + 1] = 'B'
		elif s[i] in s2 and s[i + 2] in s2:
			s[i + 1] = 'G'
		else:
			s[i + 1] = 'R'
if s[-2] == s[-1]:
	res += 1
	if s[-2] == 'R' or s[-2] == 'B':
		s[-1] = 'G'
	else:
		s[-1] = 'R'
print(res)
print(''.join(s))


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()
arr = []
for i in s:
	arr.append(i)
rr = []
c = 0
for i in range(0, len(s), 3):
	if arr[i] != 'R':
		c += 1
	if i + 1 < n and arr[i + 1] != 'G':
		c += 1
	if i + 2 < n and arr[i + 2] != 'B':
		c += 1
rr.append(c)
c = 0
for i in range(0, len(s), 3):
	if arr[i] != 'R':
		c += 1
	if i + 1 < n and arr[i + 1] != 'B':
		c += 1
	if i + 2 < n and arr[i + 2] != 'G':
		c += 1
rr.append(c)
c = 0
for i in range(0, len(s), 3):
	if arr[i] != 'B':
		c += 1
	if i + 1 < n and arr[i + 1] != 'R':
		c += 1
	if i + 2 < n and arr[i + 2] != 'G':
		c += 1
rr.append(c)
c = 0
for i in range(0, len(s), 3):
	if arr[i] != 'B':
		c += 1
	if i + 1 < n and arr[i + 1] != 'G':
		c += 1
	if i + 2 < n and arr[i + 2] != 'R':
		c += 1
rr.append(c)
c = 0
for i in range(0, len(s), 3):
	if arr[i] != 'G':
		c += 1
	if i + 1 < n and arr[i + 1] != 'R':
		c += 1
	if i + 2 < n and arr[i + 2] != 'B':
		c += 1
rr.append(c)
c = 0
for i in range(0, len(s), 3):
	if arr[i] != 'G':
		c += 1
	if i + 1 < n and arr[i + 1] != 'B':
		c += 1
	if i + 2 < n and arr[i + 2] != 'R':
		c += 1
temp = ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']
rr.append(c)
mm = min(rr)
inde = rr.index(mm)
ans = ''
while len(ans) < n:
	ans += temp[inde]
print(mm)
print(ans[0:n])


from fractions import gcd
from itertools import combinations, permutations, accumulate, product
from collections import deque, defaultdict, Counter
import decimal
import re
import math
import bisect
import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7
from sys import stdin
readline = stdin.readline

def readInts():
	return list(map(int, readline().split()))

def readTuples():
	return tuple(map(int, readline().split()))

def I():
	return int(readline())
n = I()
s = list(input())
ans = float('inf')
cnt = 0
for i in range(1, n):
	comp = list(s[i - 1:i + 1])
	if comp[0] == comp[1]:
		if comp[1] == 'R':
			if i + 1 < n:
				if s[i + 1] == 'R':
					s[i] = 'G'
					cnt += 1
				elif s[i + 1] == 'G':
					s[i] = 'B'
					cnt += 1
				elif s[i + 1] == 'B':
					s[i] = 'G'
					cnt += 1
			else:
				s[i] = 'G'
				cnt += 1
		elif comp[1] == 'G':
			if i + 1 < n:
				if s[i + 1] == 'G':
					s[i] = 'B'
					cnt += 1
				elif s[i + 1] == 'R':
					s[i] = 'B'
					cnt += 1
				elif s[i + 1] == 'B':
					s[i] = 'R'
					cnt += 1
			else:
				cnt += 1
				s[i] = 'R'
		elif comp[1] == 'B':
			if i + 1 < n:
				if s[i + 1] == 'B':
					s[i] = 'R'
					cnt += 1
				elif s[i + 1] == 'R':
					s[i] = 'G'
					cnt += 1
				elif s[i + 1] == 'G':
					s[i] = 'R'
					cnt += 1
			else:
				s[i] = 'R'
				cnt += 1
print(cnt)
print(*s, sep='')


a = int(input())
b = str(input())
c = ['RGB', 'RBG', 'BGR', 'BRG', 'GBR', 'GRB']
x = a % 3
y = a // 3
w = 0
for i in range(6):
	l = 0
	k = c[i] * y + c[i][:x]
	for j in range(a):
		if k[j:j + 1] == b[j:j + 1]:
			l += 1
	if l > w:
		w = l
		s = k
print(a - w)
print(s)


n = int(input())
s = input()
vrs = ['RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB']
minn = None
minn_var = None
for need in vrs:
	cur_cnt = 0
	for i in range(n):
		if need[i % 3] != s[i]:
			cur_cnt += 1
	if minn is None or cur_cnt < minn:
		minn = cur_cnt
		minn_var = need
print(minn)
print(minn_var * (n // 3) + minn_var[:n % 3])


n = int(input())
a = input()
s = ('RGB', 'RBG', 'BRG', 'BGR', 'GBR', 'GRB')
d = []
for x in s:
	b = []
	cnt = 0
	for i in range(n):
		b.append(x[i % 3])
		if x[i % 3] != a[i]:
			cnt += 1
	d.append([cnt, ''.join(b)])
d = sorted(d)
print(d[0][0], d[0][1])


def diverseGarland(n, garland):
	(prev, curr, Next) = (None, None, None)
	arr = ['R', 'G', 'B']
	count = 0
	for i in range(0, n):
		prev = garland[i - 1] if i != 0 else None
		curr = garland[i]
		Next = garland[i + 1] if i != n - 1 else None
		if prev == curr and prev is not None:
			prev = Next if prev is None else prev
			Next = prev if Next is None else Next
			for ele in arr:
				if prev != ele and Next != ele:
					garland[i] = ele
					count += 1
					break
	print(count)
	for ele in garland:
		print(ele, end='')
n = int(input())
garland = [ele for ele in input()]
diverseGarland(n, garland)


n = int(input())
s = input()
a = ['GRB', 'GBR', 'BGR', 'BRG', 'RGB', 'RBG']
f = []
h = n
u = ''
for m in a:
	b = []
	l = 0
	p = ''
	if n % 3 == 0:
		d = n // 3
	else:
		d = n // 3 + 1
	for w in range(0, d):
		b.append(m[0])
		b.append(m[1])
		b.append(m[2])
	for w in range(0, n):
		p = p + b[w]
		if s[w] != b[w]:
			l += 1
	if h > l:
		h = l
		u = p
print(h)
print(u)


n = int(input())
s = list(input())
k = 0
a = set('RGB')
for i in range(1, n):
	if s[i] == s[i - 1]:
		k += 1
		s[i] = list(a - set(s[i:i + 2]))[0]
print(k)
print(''.join(s))


input()
g = list(input())
r = 0
RGB = ('R', 'G', 'B')
for i in range(len(g) - 1):
	if g[i] == g[i + 1]:
		r += 1
		g[i + 1] = RGB[(RGB.index(g[i]) + 1) % 3]
		if i != len(g) - 2 and g[i + 1] == g[i + 2]:
			g[i + 1] = RGB[(RGB.index(g[i + 1]) + 1) % 3]
print(f"{str(r)}\n{''.join(g)}")


import math
import sys
input = sys.stdin.readline
n = int(input())
s = input()
(c1, c2, c3, c4, c5, c6) = (0, 0, 0, 0, 0, 0)
i = 0
while i < n:
	k = i % 3
	if k == 0:
		if s[i] != 'R':
			c1 += 1
			c2 += 1
		if s[i] != 'G':
			c3 += 1
			c4 += 1
		if s[i] != 'B':
			c5 += 1
			c6 += 1
	if k == 1:
		if s[i] != 'R':
			c3 += 1
			c5 += 1
		if s[i] != 'G':
			c1 += 1
			c6 += 1
		if s[i] != 'B':
			c2 += 1
			c4 += 1
	if k == 2:
		if s[i] != 'R':
			c4 += 1
			c6 += 1
		if s[i] != 'G':
			c2 += 1
			c5 += 1
		if s[i] != 'B':
			c1 += 1
			c3 += 1
	i += 1
if c1 == min(c1, c2, c3, c4, c5, c6):
	print(c1)
	for i in range(n):
		if i % 3 == 0:
			print('R', end='')
		elif i % 3 == 1:
			print('G', end='')
		else:
			print('B', end='')
	exit()
if c2 == min(c1, c2, c3, c4, c5, c6):
	print(c2)
	for i in range(n):
		if i % 3 == 0:
			print('R', end='')
		elif i % 3 == 1:
			print('B', end='')
		else:
			print('G', end='')
	exit()
if c3 == min(c1, c2, c3, c4, c5, c6):
	print(c3)
	for i in range(n):
		if i % 3 == 0:
			print('G', end='')
		elif i % 3 == 1:
			print('R', end='')
		else:
			print('B', end='')
	exit()
if c4 == min(c1, c2, c3, c4, c5, c6):
	print(c4)
	for i in range(n):
		if i % 3 == 0:
			print('G', end='')
		elif i % 3 == 1:
			print('B', end='')
		else:
			print('R', end='')
	exit()
if c5 == min(c1, c2, c3, c4, c5, c6):
	print(c5)
	for i in range(n):
		if i % 3 == 0:
			print('B', end='')
		elif i % 3 == 1:
			print('R', end='')
		else:
			print('G', end='')
	exit()
if c6 == min(c1, c2, c3, c4, c5, c6):
	print(c6)
	for i in range(n):
		if i % 3 == 0:
			print('B', end='')
		elif i % 3 == 1:
			print('G', end='')
		else:
			print('R', end='')


n = int(input())
s = list(input())
k = 0
if n > 1:
	for i in range(n - 2):
		if s[i] == s[i + 1]:
			if s[i + 2] == 'R':
				if s[i] != 'G':
					s[i + 1] = 'G'
				elif s[i] != 'B':
					s[i + 1] = 'B'
			elif s[i + 2] == 'G':
				if s[i] != 'B':
					s[i + 1] = 'B'
				elif s[i] != 'R':
					s[i + 1] = 'R'
			elif s[i] != 'R':
				s[i + 1] = 'R'
			elif s[i] != 'G':
				s[i + 1] = 'G'
			k += 1
	if s[len(s) - 2] == s[len(s) - 1]:
		if s[len(s) - 2] == 'R':
			s[len(s) - 1] = 'G'
		elif s[len(s) - 2] == 'G':
			s[len(s) - 1] = 'B'
		else:
			s[len(s) - 1] = 'R'
		k += 1
print(k)
for i in s:
	print(i, end='')


n = int(input())
str = input()
(min, ans) = (n + 1, '')

def check(pattern):
	global min, ans
	(remod, diff) = ('', 0)
	for i in range(n):
		c = pattern[i % 3]
		remod += c
		if str[i] != pattern[i % 3]:
			diff += 1
	if diff < min:
		(min, ans) = (diff, remod)
check('RGB')
check('RBG')
check('BGR')
check('BRG')
check('GBR')
check('GRB')
print(min, ans)


n = int(input())
t = input()
m = n % 3
kouho = [[] for _ in range(6)]
if m == 1:
	kouho[0] = 'RGB' * int(n / 3) + 'R'
	kouho[1] = 'GBR' * int(n / 3) + 'G'
	kouho[2] = 'BRG' * int(n / 3) + 'B'
	kouho[3] = 'RBG' * int(n / 3) + 'R'
	kouho[4] = 'GRB' * int(n / 3) + 'G'
	kouho[5] = 'BGR' * int(n / 3) + 'B'
elif m == 2:
	kouho[0] = 'RGB' * int(n / 3) + 'RG'
	kouho[1] = 'GBR' * int(n / 3) + 'GB'
	kouho[2] = 'BRG' * int(n / 3) + 'BR'
	kouho[3] = 'RBG' * int(n / 3) + 'RB'
	kouho[4] = 'GRB' * int(n / 3) + 'GR'
	kouho[5] = 'BGR' * int(n / 3) + 'BG'
elif m == 0:
	kouho[0] = 'RGB' * int(n / 3)
	kouho[1] = 'GBR' * int(n / 3)
	kouho[2] = 'BRG' * int(n / 3)
	kouho[3] = 'RBG' * int(n / 3)
	kouho[4] = 'GRB' * int(n / 3)
	kouho[5] = 'BGR' * int(n / 3)
list_all = [list(ko) for ko in kouho]
listt = list(t)
sa = [0 for _ in range(6)]
for k in range(6):
	for i in range(n):
		if list_all[k][i] != listt[i]:
			sa[k] += 1
		else:
			pass
out = min(sa)
print(out)
if out == 0:
	print(t)
else:
	for k in range(6):
		if out == sa[k]:
			print(kouho[k])
			break
		else:
			continue


n = int(input())
s = [l for l in input()]
bs = s
v = ('RGB', 'GBR', 'BRG', 'RBG', 'BGR', 'GRB')
mc = -1
for vi in v:
	c = 0
	i = -1
	ts = list(s)
	for l in s:
		i += 1
		if l != vi[i % 3]:
			c += 1
			ts[i] = vi[i % 3]
	if mc == -1:
		mc = c
	if c <= mc:
		mc = c
		bs = ts
print(mc)
print(''.join(bs))


t = int(input(''))
s = input('')
s1 = []
cnt = [0, 0, 0, 0, 0, 0]
ans = 0
for i in range(1):
	s1.append(['R', 'G', 'B'])
	s1.append(['R', 'B', 'G'])
	s1.append(['G', 'B', 'R'])
	s1.append(['G', 'R', 'B'])
	s1.append(['B', 'R', 'G'])
	s1.append(['B', 'G', 'R'])
for i in range(t):
	j = i % 3
	if s[i] != s1[0][j]:
		cnt[0] += 1
	if s[i] != s1[1][j]:
		cnt[1] += 1
	if s[i] != s1[2][j]:
		cnt[2] += 1
	if s[i] != s1[3][j]:
		cnt[3] += 1
	if s[i] != s1[4][j]:
		cnt[4] += 1
	if s[i] != s1[5][j]:
		cnt[5] += 1
m = min(cnt)
if m != 0:
	for i in range(6):
		if m == cnt[i]:
			x = i
			break
	print(cnt[x])
	for i in range(t):
		j = i % 3
		print(s1[x][j], end='')
	print('')
else:
	print('0')
	print(s)


n = int(input())
st = list(input())
ans = int(2000000000.0)
s = ['RGB', 'RBG', 'BRG', 'BGR', 'GRB', 'GBR']
an = ''
cnt = 0
kek = ''
for i in range(6):
	cnt = 0
	kek = ''
	cc = s[i]
	for j in range(n):
		kek += cc[j % 3]
		if cc[j % 3] != st[j]:
			cnt += 1
	if cnt < ans:
		ans = cnt
		an = kek
print(str(ans) + '\n' + an)


from sys import stdin, stdout
n = int(stdin.readline())
s = stdin.readline()
ans = n
k = 0
tk = 0
for i in range(n):
	if i % 3 == 0 and s[i] != 'R':
		k += 1
	elif i % 3 == 1 and s[i] != 'G':
		k += 1
	elif i % 3 == 2 and s[i] != 'B':
		k += 1
if k < ans:
	ans = k
	tk = 0
k = 0
for i in range(n):
	if i % 3 == 0 and s[i] != 'R':
		k += 1
	elif i % 3 == 1 and s[i] != 'B':
		k += 1
	elif i % 3 == 2 and s[i] != 'G':
		k += 1
if k < ans:
	ans = k
	tk = 1
k = 0
for i in range(n):
	if i % 3 == 0 and s[i] != 'B':
		k += 1
	elif i % 3 == 1 and s[i] != 'R':
		k += 1
	elif i % 3 == 2 and s[i] != 'G':
		k += 1
if k < ans:
	ans = k
	tk = 2
k = 0
for i in range(n):
	if i % 3 == 0 and s[i] != 'B':
		k += 1
	elif i % 3 == 1 and s[i] != 'G':
		k += 1
	elif i % 3 == 2 and s[i] != 'R':
		k += 1
if k < ans:
	ans = k
	tk = 3
k = 0
for i in range(n):
	if i % 3 == 0 and s[i] != 'G':
		k += 1
	elif i % 3 == 1 and s[i] != 'R':
		k += 1
	elif i % 3 == 2 and s[i] != 'B':
		k += 1
if k < ans:
	ans = k
	tk = 4
k = 0
for i in range(n):
	if i % 3 == 0 and s[i] != 'G':
		k += 1
	elif i % 3 == 1 and s[i] != 'B':
		k += 1
	elif i % 3 == 2 and s[i] != 'R':
		k += 1
if k < ans:
	ans = k
	tk = 5
stdout.write('%d\n' % ans)
p = n // 3 + 1
ans = ''
if tk == 0:
	ans = 'RGB' * p
elif tk == 1:
	ans = 'RBG' * p
elif tk == 2:
	ans = 'BRG' * p
elif tk == 3:
	ans = 'BGR' * p
elif tk == 4:
	ans = 'GRB' * p
else:
	ans = 'GBR' * p
stdout.write(ans[:n])


import sys
import itertools
import math
import collections
from collections import Counter

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = prime[1] = False
	r = [p for p in range(n + 1) if prime[p]]
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def nextcolor(i, j):
	t = {'R', 'G', 'B'} - {i, j}
	return t.pop()
n = ii()
d = [x for x in input()]
r = 0
for i in range(n - 1):
	if d[i] == d[i + 1]:
		d[i + 1] = nextcolor(d[i], d[i]) if i == n - 2 else nextcolor(d[i], d[i + 2])
		r += 1
print(r)
prr(d, '')


n = int(input())
s = list(input())
f = [[0 for i in range(2)] for x in range(n + 1)]
trace = [[0 for i in range(2)] for x in range(n + 1)]
f[0][0] = 0
f[0][1] = 1

def change(s, x):
	if x == 0 or s[x - 1] != 'R':
		if x == n - 1 or s[x + 1] != 'R':
			return 'R'
	if x == 0 or s[x - 1] != 'B':
		if x == n - 1 or s[x + 1] != 'B':
			return 'B'
	if x == 0 or s[x - 1] != 'G':
		if x == n - 1 or s[x + 1] != 'G':
			return 'G'
for i in range(1, n):
	if s[i] == s[i - 1]:
		f[i][0] = f[i - 1][1]
		trace[i][0] = 1
		if f[i - 1][1] < f[i - 1][0]:
			f[i][1] = f[i - 1][1] + 1
			trace[i][1] = 1
		else:
			f[i][1] = f[i - 1][0] + 1
			trace[i][1] = 0
	elif f[i - 1][0] < f[i - 1][1]:
		f[i][0] = f[i - 1][0]
		trace[i][0] = 0
		f[i][1] = f[i - 1][0] + 1
		trace[i][1] = 0
	else:
		f[i][0] = f[i - 1][1]
		trace[i][0] = 1
		f[i][1] = f[i - 1][1] + 1
		trace[i][1] = 1
if f[n - 1][1] > f[n - 1][0]:
	print(f[n - 1][0])
	sign = 0
else:
	print(f[n - 1][1])
	sign = 1
for i in range(n - 1, 0, -1):
	if sign == 0:
		sign = trace[i][0]
	else:
		s[i] = change(s, i)
		sign = trace[i][1]
print(''.join(s))


import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline()[:-1]
changes = 0
last = s[0]
ans = last
for i in range(1, n):
	if s[i] == last:
		changes = changes + 1
		if i < n - 1:
			color = 'R'
			if s[i - 1] != color and s[i + 1] != color:
				last = color
				ans = ans + last
			else:
				color = 'G'
				if s[i - 1] != color and s[i + 1] != color:
					last = color
					ans = ans + last
				else:
					color = 'B'
					if s[i - 1] != color and s[i + 1] != color:
						last = color
						ans = ans + last
		elif s[i - 1] != 'R':
			ans = ans + 'R'
		else:
			ans = ans + 'G'
	else:
		ans = ans + s[i]
		last = s[i]
print(changes)
print(ans)


n = int(input())
s = list(input().rstrip())
if len(s) == 1:
	print(0)
	print(s[0])
	exit()
c = ['R', 'G', 'B']
cnt = 0
for i in range(1, len(s) - 1):
	if s[i - 1] == s[i]:
		if s[i] == s[i + 1]:
			for co in c:
				if co != s[i]:
					s[i] = co
					break
		else:
			for co in c:
				if co != s[i] and co != s[i + 1]:
					s[i] = co
					break
		cnt += 1
if s[-2] == s[-1]:
	for co in c:
		if co != s[-1]:
			s[-1] = co
			break
	cnt += 1
print(cnt)
print(''.join(s))


n = int(input())
s = list(input())
q = s[0]
count = 0
for i in range(1, n - 1):
	if s[i] == q:
		if s[i + 1] == 'G' and q == 'B':
			s[i] = 'R'
		elif s[i + 1] == 'G' and q == 'G':
			s[i] = 'B'
		elif s[i + 1] == 'G' and q == 'R':
			s[i] = 'B'
		elif s[i + 1] == 'R' and q == 'G':
			s[i] = 'B'
		elif s[i + 1] == 'R' and q == 'R':
			s[i] = 'G'
		elif s[i + 1] == 'R' and q == 'B':
			s[i] = 'G'
		elif s[i + 1] == 'B' and q == 'R':
			s[i] = 'G'
		elif s[i + 1] == 'B' and q == 'G':
			s[i] = 'R'
		elif s[i + 1] == 'B' and q == 'B':
			s[i] = 'R'
		count += 1
	q = s[i]
if s[n - 1] == q and n != 1:
	count += 1
	if q == 'R':
		s[n - 1] = 'B'
	elif q == 'B':
		s[n - 1] = 'R'
	else:
		s[n - 1] = 'B'
print(count)
for i in range(n):
	print(s[i], end='')


q = int(input())
s = str(input())
tot = 0
s = list(s)
for i in range(1, len(s)):
	if s[i] == s[i - 1]:
		m = 'RGB'
		m = m.replace(s[i - 1], '')
		if i + 1 != len(s):
			m = m.replace(s[i + 1], '')
		s[i] = m[0]
		tot += 1
print(tot)
print(''.join(s))


n = int(input())
f = {'R': 0, 'G': 1, 'B': 2}
b = ['R', 'G', 'B']
s = [_ for _ in input()]
res = 0
for i in range(1, len(s) - 1):
	if s[i] == s[i - 1]:
		if (f[s[i]] + 1) % 3 == f[s[i + 1]]:
			s[i] = b[f[s[i]] - 1]
		else:
			s[i] = b[f[s[i]] - 2]
		res = res + 1
if len(s) > 1 and s[-1] == s[-2]:
	s[-1] = b[f[s[-2]] - 1]
	res = res + 1
print(res)
print(''.join(s))


n = int(input())
s = input()
ans = 0
temp = ['R', 'G', 'B']
util = [0 for i in range(n)]
j = 0
while j < len(s):
	i = j + 1
	count = 1
	while i < len(s) and s[i] == s[j]:
		i += 1
		count += 1
	for k in range(j, i):
		util[k] = count
	j = i
st = ''
i = 0
while i < n:
	if i != n - 1 and s[i] == s[i + 1]:
		if util[i] % 2 == 0:
			if s[i] == 'R':
				if i > 0:
					if s[i - 1] == 'G':
						phrase = 'BR'
					else:
						phrase = 'GR'
				else:
					phrase = 'GR'
			elif s[i] == 'B':
				if i > 0:
					if s[i - 1] == 'G':
						phrase = 'RB'
					else:
						phrase = 'GB'
				else:
					phrase = 'GB'
			elif i > 0:
				if s[i - 1] == 'R':
					phrase = 'BG'
				else:
					phrase = 'RG'
			else:
				phrase = 'RG'
			count = util[i] // 2
			i += util[i]
			ans += count
			st += phrase * count
		else:
			if s[i] == 'R':
				phrase = 'RG'
			elif s[i] == 'G':
				phrase = 'GB'
			else:
				phrase = 'BR'
			count = util[i] // 2
			ans += count
			st += phrase * count
			st += s[i]
			i += 2 * count + 1
	else:
		st += s[i]
		i += 1
print(ans, st, sep='\n')


n = int(input())
s = input()
r = [0] * n
g = [0] * n
b = [0] * n
r[0] = (int(s[0] != 'R'), None)
g[0] = (int(s[0] != 'G'), None)
b[0] = (int(s[0] != 'B'), None)
for i in range(1, n):
	if g[i - 1][0] < b[i - 1][0]:
		r[i] = (g[i - 1][0] + int(s[i] != 'R'), 'G')
	else:
		r[i] = (b[i - 1][0] + int(s[i] != 'R'), 'B')
	if r[i - 1][0] < b[i - 1][0]:
		g[i] = (r[i - 1][0] + int(s[i] != 'G'), 'R')
	else:
		g[i] = (b[i - 1][0] + int(s[i] != 'G'), 'B')
	if r[i - 1][0] < g[i - 1][0]:
		b[i] = (r[i - 1][0] + int(s[i] != 'B'), 'R')
	else:
		b[i] = (g[i - 1][0] + int(s[i] != 'B'), 'G')
x = min(r[-1][0], g[-1][0], b[-1][0])
print(x)
if r[-1][0] == x:
	out = 'R'
	curr = 'R'
elif g[-1][0] == x:
	out = 'G'
	curr = 'G'
else:
	out = 'B'
	curr = 'B'
for i in range(n - 1, 0, -1):
	if curr == 'R':
		out += r[i][1]
		curr = r[i][1]
	elif curr == 'G':
		out += g[i][1]
		curr = g[i][1]
	else:
		out += b[i][1]
		curr = b[i][1]
print(out[::-1])


n = int(input())
x = list(input())
c = 0
for i in range(1, n):
	if x[i] == x[i - 1]:
		c += 1
		if i < n - 1 and x[i] == x[i + 1]:
			if x[i] == 'G':
				x[i] = 'R'
			elif x[i] == 'B':
				x[i] = 'G'
			else:
				x[i] = 'B'
		elif i < n - 1 and x[i] != x[i + 1]:
			if x[i] != 'G' and x[i + 1] != 'G':
				x[i] = 'G'
			elif x[i] != 'B' and x[i + 1] != 'B':
				x[i] = 'B'
			else:
				x[i] = 'R'
		elif x[i] == 'G':
			x[i] = 'R'
		elif x[i] == 'B':
			x[i] = 'G'
		else:
			x[i] = 'B'
print(c)
print(''.join(x))


def diverse_garland(n, strng):
	strng = list(strng)
	count = 0
	for i in range(n - 1):
		if strng[i] != strng[i + 1]:
			continue
		else:
			l = ['R', 'G', 'B']
			count += 1
			if i == n - 2:
				l.remove(strng[i])
			else:
				l.remove(strng[i])
				if strng[i + 2] in l:
					l.remove(strng[i + 2])
			strng[i + 1] = l[0]
	strng = ''.join(strng)
	print(count)
	print(strng)
n = int(input())
strng = input()
diverse_garland(n, strng)


import itertools
N = int(input())
S = input()
ans = ('', 1000000)
for p in itertools.permutations('RGB', 3):
	cnt = 0
	for i in range(N):
		if S[i] != p[i % 3]:
			cnt += 1
	if cnt < ans[1]:
		ans = (''.join(p), cnt)
print(ans[1], (ans[0] * ((N + 2) // 3))[:N], sep='\n')


n = int(input())
b = input()
a = list(b)
r = set('RGB')
ans = 0
if n > 1:
	for i in range(len(a) - 2):
		if a[i] == a[i + 1]:
			x = r - set(a[i] + a[i + 2])
			ans += 1
			for j in x:
				a[i + 1] = j
	if a[-2] == a[-1]:
		x = r - set(a[-2])
		for j in x:
			a[-1] = j
		ans += 1
	print(ans)
	print(*a, sep='')
else:
	print(0, b, sep='\n')