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 diverse.

A garland is called diverse if any two adjacent (consecutive) lamps (i. e. such lamps that the distance between their positions is $1$) have distinct colors.

In other words, if the obtained garland is $t$ then for each $i$ from $1$ to $n-1$ the condition $t_i \ne t_{i + 1}$ should be satisfied.

Among all ways to recolor the initial garland to make it diverse 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 diverse garland from the given one.

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


-----Examples-----
Input
9
RBGRRBRGG

Output
2
RBGRGBRGR

Input
8
BBBGBRRR

Output
2
BRBGBRGR

Input
13
BBRRRRGGGGGRR

Output
6
BGRBRBGBGBGRG

Source: codeforces | Difficulty: MEDIUM
Tags: Greedy algorithms

Dynamic programming

Constructive algorithms


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


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


import sys

def answer(n, s):
	num_changes = 0
	choices = {'R', 'G', 'B'}
	ans = [s[0]]
	for i in range(1, n):
		if s[i] != ans[-1]:
			ans.append(s[i])
		else:
			temp = {'R', 'G', 'B'}
			temp.discard(s[i])
			if i < n - 1:
				temp.discard(s[i + 1])
			ans.append(temp.pop())
			num_changes += 1
	print(num_changes)
	print(''.join(ans))
	return

def main():
	n = int(sys.stdin.readline())
	s = sys.stdin.readline().rstrip()
	answer(n, s)
	return
main()


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


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)


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


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


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())
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, ''.join(s[:-1]))


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


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)


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 sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from itertools import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from os import *

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 = read(self._fd, max(fstat(self._fd).st_size, 8192))
			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 = read(self._fd, max(fstat(self._fd).st_size, 8192))
			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:
			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')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))

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

def fast():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (fast, lambda : map(int, z().split()))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

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

def output(answer, end='\n'):
	stdout.write(str(answer) + end)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
n = int(z())
arr = list(fast())
ans = 0
for i in range(1, n - 1):
	a = arr[i - 1]
	b = arr[i]
	c = arr[i + 1]
	if a == b:
		if b == 'R' and c != 'B':
			arr[i] = 'B'
		elif b == 'R' and c != 'G':
			arr[i] = 'G'
		elif b == 'G' and c != 'B':
			arr[i] = 'B'
		elif b == 'G' and c != 'R':
			arr[i] = 'R'
		elif b == 'B' and c != 'R':
			arr[i] = 'R'
		elif b == 'B' and c != 'G':
			arr[i] = 'G'
		ans += 1
if n == 1:
	print(0)
	print(*arr)
	exit()
a = arr[-2]
b = arr[-1]
if a == b:
	if a == 'R':
		arr[-1] = 'G'
	if a == 'G':
		arr[-1] = 'R'
	if a == 'B':
		arr[-1] = 'G'
	ans += 1
print(ans)
print(''.join(arr))


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


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


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


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


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


r = 'RGB'
n = int(input())
l = [r.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, ''.join((r[i] for i in l[:-1])))


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)


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


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


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 = 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
n = int(input())
lamps = input()
if len(lamps) == 1:
	print(0)
	print(lamps)
	return

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


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


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


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


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


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


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


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


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


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


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


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


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


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


import math
from math import log2, sqrt
from bisect import bisect_left, bisect_right
import bisect
import sys
from sys import stdin, stdout
import os
sys.setrecursionlimit(pow(10, 6))
import collections
from collections import defaultdict
from statistics import median
inf = float('inf')

def blue(a):
	return a == 'B'

def red(a):
	return a == 'R'

def green(a):
	return a == 'G'

def fun(l, r):
	for i in range(1, len(l)):
		if i == len(l) - 1:
			if l[i] == l[i - 1]:
				if l[i] == 'R':
					l[i] = 'B'
				else:
					l[i] = 'R'
				r += 1
		if l[i] == l[i - 1]:
			prev = l[i - 1]
			next = l[i + 1]
			now = l[i]
			sum = prev + next
			if 'RR' in sum:
				l[i] = 'B'
				r += 1
				continue
			if 'BB' in sum:
				l[i] = 'G'
				r += 1
				continue
			if 'GG' in sum:
				l[i] = 'R'
				r += 1
				continue
			if 'R' not in sum:
				l[i] = 'R'
				r += 1
				continue
			if 'G' not in sum:
				l[i] = 'G'
				r += 1
				continue
			if 'B' not in sum:
				l[i] = 'B'
				r += 1
				continue
	return r
n = int(input())
l = list(map(str, input()))
r = fun(l, 0)
print(r)
change = defaultdict(int)
print(''.join(l))


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 = 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())
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())
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]))


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


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


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())
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())
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='')


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


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())
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()
ar = list(s)
k = 0
if n == 1:
	print(0)
	print(s)
elif n == 2:
	if len(set(s)) == 1:
		if ar[0] == 'R':
			print(1)
			print('RG')
		elif ar[0] == 'G':
			print(1)
			print('GB')
		else:
			print(1)
			print('BR')
	else:
		print(0)
		print(s)
else:
	for i in range(1, n - 1):
		if ar[i] == ar[i - 1]:
			if ar[i] == 'R':
				if ar[i + 1] == 'G':
					ar[i] = 'B'
				else:
					ar[i] = 'G'
			elif ar[i] == 'G':
				if ar[i + 1] == 'B':
					ar[i] = 'R'
				else:
					ar[i] = 'B'
			elif ar[i + 1] == 'R':
				ar[i] = 'G'
			else:
				ar[i] = 'R'
			k = k + 1
	if ar[-1] == ar[-2]:
		if ar[-2] == 'R':
			ar[-1] = 'G'
		elif ar[-2] == 'G':
			ar[-1] = 'R'
		else:
			ar[-1] = 'G'
		k = k + 1
	print(k)
	print(''.join(ar))


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)


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


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


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 = 0
	d = {'RR': 'B', 'BB': 'G', 'GG': 'R', 'RB': 'G', 'RG': 'B', 'BR': 'G', 'GR': 'B', 'BG': 'R', 'GB': 'R', 'R': 'B', 'B': 'G', 'G': 'R'}
	for i in range(n - 1):
		if a[i] == a[i + 1]:
			t += 1
			if i < n - 2:
				a[i + 1] = d[a[i] + a[i + 2]]
			else:
				a[i + 1] = d[a[i]]
	print(t)
	print(''.join(a))
hnbhai()


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


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)


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


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


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


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


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


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


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


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


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


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


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


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())
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='')


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


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)


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
n = int(input())
s = input()
o = ['R', 'G', 'B']
a = [s[i] for i in range(n)]
c = 0
if n > 2:
	for i in range(n - 2):
		if a[i] == a[i + 1]:
			for j in range(3):
				if a[i + 1] != o[j] and a[i + 2] != o[j]:
					a[i + 1] = o[j]
					break
			c += 1
	if a[-2] == a[-1]:
		c += 1
		for j in range(3):
			if a[-1] != o[j]:
				a[-1] = o[j]
				break
	print(c)
	print(''.join(a))
elif n == 1:
	print(0)
	print(s)
elif s[0] == s[1]:
	print(1)
	for j in range(3):
		if o[j] != s[0]:
			print(f'{s[0]}{o[j]}')
			break
else:
	print(0)
	print(s)


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


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 os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase
from fractions import *

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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 value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
a = list(input())
i = 0
ans = 0
color = ['R', 'G', 'B']
d = {'R': 1, 'G': 2, 'B': 3}
while i < n:
	c = 1
	i += 1
	while i < n and a[i] == a[i - 1]:
		c += 1
		if c % 2 == 0:
			a[i] = '-'
		i += 1
	ans += c // 2
for i in range(n):
	if a[i] == '-' and i == 0:
		a[i] = color[d[a[i + 1]] % 3]
	elif a[i] == '-' and i == n - 1:
		a[i] = color[d[a[i - 1]] % 3]
	elif a[i] == '-':
		if a[i - 1] == a[i + 1]:
			a[i] = color[d[a[i - 1]] % 3]
		else:
			a[i] = color[5 - d[a[i - 1]] - d[a[i + 1]]]
print(ans)
print(''.join(a))


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)


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


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


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


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


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


n = int(input())
b = input()
a = []
p = []
for i in range(n):
	a.append(b[i])
c = 0
h = 'I'
for j in range(n):
	if j + 1 == n:
		if a[j] == h:
			c += 1
			if a[j - 1] != 'R':
				a[j] = 'R'
			elif a[j - 1] != 'G':
				a[j] = 'G'
			else:
				a[j] = 'B'
	elif a[j] == h:
		c += 1
		if a[j - 1] != 'R' and a[j + 1] != 'R':
			a[j] = 'R'
		elif a[j - 1] != 'G' and a[j + 1] != 'G':
			a[j] = 'G'
		else:
			a[j] = 'B'
	h = a[j]
print(c)
for k in range(n):
	print(a[k], end='')


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())
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())
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='')


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


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([int(len(x) / 2) for x in sp_l]))
print(''.join(sp_l))


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())
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='')


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


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


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


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


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