#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int n,cnt,b[N];
char c;
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
         cin>>c;
         if(c=='R')
            b[i]=0;
         if(c=='B')
            b[i]=1;
         if(c=='G')
            b[i]=2;
    }
    for(int i=1;i<n;i++){
        if(b[i]==b[i-1]){
            cnt++;
            if(b[i]!=b[i+1]){
                b[i]=3-b[i+1]-b[i-1];
        }
        else
            b[i]=(b[i]+1)%3;

        }
    }
        cout<<cnt<<endl;
        for(int i=0;i<n;i++){
            if(b[i]==0)
                cout<<'R';
            if(b[i]==1)
                cout<<'B';
            if(b[i]==2)
                cout<<'G';
        }
        system("pause");
        return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int n;
int b[N];
char c;
int cnt;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(int i=0;i<n;i++){
         cin>>c;
         if(c=='R')
            b[i]=0;
         if(c=='B')
            b[i]=1;
         if(c=='G')
            b[i]=2;
    }
    for(int i=1;i<n;i++){
        if(b[i]==b[i-1])
        {
            cnt++;
            if(b[i]!=b[i+1]){
                b[i]=3-b[i+1]-b[i-1];
        }
        else
            b[i]=(b[i]+1)%3;

        }
    }
        cout<<cnt<<endl;
        for(int i=0;i<n;i++)
        {
            if(b[i]==0)
                cout<<'R';
            if(b[i]==1)
                cout<<'B';
            if(b[i]==2)
                cout<<'G';
        }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int ans, n;
string s;
char rgb[3]={'R','G','B'};
map<char, int> a;
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;cin>>s;
	a['R']=0;a['G']=1;a['B']=2;

	for(int i=1;i<n;i++){
		if(s[i]==s[i-1]){
			 ans++;
		if(s[i]!=s[i+1])
            s[i]=rgb[3-a[s[i+1]]-a[s[i-1]]];
        else
            s[i]=rgb[(a[s[i]]+1)%3];
		}
	}

	cout<<ans<<"\n";
	cout<<s;
	//system("pause");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int ans, n;
string s;
char rgb[3]={'R','G','B'};
map<char, int> a;
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;cin>>s;
	a['R']=0;a['G']=1;a['B']=2;

	for(int i=1;i<n;i++){
		if(s[i]==s[i-1]){
			 ans++;
		if(s[i]!=s[i+1])
            s[i]=rgb[3-a[s[i+1]]-a[s[i-1]]];
        else
            s[i]=rgb[(a[s[i]]+1)%3];
		}
	}
	cout<<ans<<"\n";
	cout<<s;
	//system("pause");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int ans, n;
string s;
char rgb[4]={'R','G','B'};
map<char, int> a;
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	cin>>s;

	a['R']=0;a['G']=1;a['B']=2;

	for(int i=1;i<n;i++){
		if(s[i]==s[i-1]){
			 ans++;
		if(s[i]!=s[i+1]&&i!=n-1)
            s[i]=rgb[3-a[s[i+1]]-a[s[i-1]]];
        else
            s[i]=rgb[(a[s[i]]+1)%3];
		}
	}
	cout<<ans<<"\n";
	for (int i = 0; i < n;i++)
		cout << s[i];
	//system("pause");
	return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#define MAX_INF 0x3f3f3f
#define ll long long
#define ull unsigned long long
const int MAXN = 2e5+10;
const int MOD = 1e9+7;
using namespace std;
#define CLR(a, b) memset((a), (b),sizeof((a)))
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<ll>())
#define mnv(v) *min_element(v.begin(),v.end())
#define mxv(v) *max_element(v.begin(),v.end())
#define G_priority_queue(v, w) priority_queue<v, vector<v>, greater<v> > w
#define L_priority_queue(v, w) priority_queue<v, vector<v>, less<v> > w
#define For_equal(p ,s, e) for(p = s;p <= e;p++)
#define For_nonequal(p, s, e) for(p = s;p < e;p++)
//ll dp[MAXN];
ll ay[130];
//ll by[50005];

int main(){
    //unordered_map<ll, int> record;
    //map<int, string>record;
    string st;
    //string st1;
    ll t;
    ll n, m;
    ll x, y;
    int i, j=1, k;
    ll a, b, c, d;
    int res = -1;
    int cnt = 0;
    int flag = 0;
    ll sum = 0;
    ll miv = MAX_INF,mav;
    cin>>n;
    cin>>st;
    if(n==1){
        cout<<'0'<<"\n";
        cout<<st<<"\n";
        return 0;
    }else if(n==2){
        if(st[0]==st[1]){
            if(st[0]=='B')
                st[1]='R';
            else if(st[0]=='G')
                st[1]='R';
            else
                st[1]='B';
        }
        cout<<'1'<<"\n";
        cout<<st<<"\n";
        return 0;
    }
    else if(n>=3){
        if(st[0]==st[1]){
            if(st[0]=='B')
                st[1]='R';
            else if(st[0]=='G')
                st[1]='R';
            else
                st[1]='B';
            cnt++;
        }
        For_nonequal(i, 1, n-2){
            if(st[i]==st[i+1]){
                if(st[i]=='B'&&st[i+2]=='B')
                    st[i+1]='G';
                else if(st[i]=='R'&&st[i+2]=='R')
                    st[i+1]='G';
                else if(st[i]=='G'&&st[i+2]=='G')
                    st[i+1]='B';
                else if(st[i]=='R'&&st[i+2]=='G')
                    st[i+1]='B';
                else if(st[i]=='R'&&st[i+2]=='B')
                    st[i+1]='G';
                else if(st[i]=='G'&&st[i+2]=='B')
                    st[i+1]='R';
                else if(st[i]=='G'&&st[i+2]=='R')
                    st[i+1]='B';
                else if(st[i]=='B'&&st[i+2]=='R')
                    st[i+1]='G';
                else if(st[i]=='B'&&st[i+2]=='G')
                    st[i+1]='R';
                cnt++;
            }
        }
        if(st[n-2]==st[n-1]){
            if(st[n-2]=='B')
                st[n-2]='R';
            else if(st[n-2]=='G')
                st[n-2]='R';
            else
                st[n-2]='B';
            cnt++;
        }
    }
    cout<<cnt<<"\n";
    cout<<st<<"\n";

    return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#define MAX_INF 0x3f3f3f
#define ll long long
#define ull unsigned long long
const int MAXN = 2e5+10;
const int MOD = 1e9+7;
using namespace std;
#define CLR(a, b) memset((a), (b),sizeof((a)))
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<ll>())
#define mnv(v) *min_element(v.begin(),v.end())
#define mxv(v) *max_element(v.begin(),v.end())
#define G_priority_queue(v, w) priority_queue<v, vector<v>, greater<v> > w
#define L_priority_queue(v, w) priority_queue<v, vector<v>, less<v> > w
#define For_equal(p ,s, e) for(p = s;p <= e;p++)
#define For_nonequal(p, s, e) for(p = s;p < e;p++)
//ll dp[MAXN];
ll ay[130];
//ll by[50005];

int main(){
    //unordered_map<ll, int> record;
    //map<int, string>record;
    string st;
    //string st1;
    ll t;
    ll n, m;
    ll x, y;
    int i, j=1, k;
    ll a, b, c, d;
    int res = -1;
    int cnt = 0;
    int flag = 0;
    ll sum = 0;
    ll miv = MAX_INF,mav;
    cin>>n;
    cin>>st;
    if(n==1){
        cout<<'0'<<"\n";
        cout<<st<<"\n";
        return 0;
    }else if(n==2){
        if(st[0]==st[1]){
            if(st[0]=='B')
                st[1]='R';
            else if(st[0]=='G')
                st[1]='R';
            else
                st[1]='B';
            cnt++;
        }
        cout<<cnt<<"\n";
        cout<<st<<"\n";
        return 0;
    }
    else if(n>=3){
        For_nonequal(i, 0, n-2){
            if(st[i]==st[i+1]){
                if(st[i]=='B'&&st[i+2]=='B')
                    st[i+1]='G';
                else if(st[i]=='R'&&st[i+2]=='R')
                    st[i+1]='G';
                else if(st[i]=='G'&&st[i+2]=='G')
                    st[i+1]='B';
                else if(st[i]=='R'&&st[i+2]=='G')
                    st[i+1]='B';
                else if(st[i]=='R'&&st[i+2]=='B')
                    st[i+1]='G';
                else if(st[i]=='G'&&st[i+2]=='B')
                    st[i+1]='R';
                else if(st[i]=='G'&&st[i+2]=='R')
                    st[i+1]='B';
                else if(st[i]=='B'&&st[i+2]=='R')
                    st[i+1]='G';
                else if(st[i]=='B'&&st[i+2]=='G')
                    st[i+1]='R';
                cnt++;
            }
        }
        if(st[n-2]==st[n-1]){
            if(st[n-2]=='B')
                st[n-1]='R';
            else if(st[n-2]=='G')
                st[n-1]='R';
            else
                st[n-1]='B';
            cnt++;
        }
    }
    cout<<cnt<<"\n";
    cout<<st<<"\n";
    return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#define MAX_INF 0x3f3f3f
#define ll long long
#define ull unsigned long long
const int MAXN = 2e5+10;
const int MOD = 1e9+7;
using namespace std;
#define CLR(a, b) memset((a), (b),sizeof((a)))
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<ll>())
#define mnv(v) *min_element(v.begin(),v.end())
#define mxv(v) *max_element(v.begin(),v.end())
#define G_priority_queue(v, w) priority_queue<v, vector<v>, greater<v> > w
#define L_priority_queue(v, w) priority_queue<v, vector<v>, less<v> > w
#define For_equal(p ,s, e) for(p = s;p <= e;p++)
#define For_nonequal(p, s, e) for(p = s;p < e;p++)
//ll dp[MAXN];
ll ay[130];
//ll by[50005];

int main(){
    //unordered_map<ll, int> record;
    //map<int, string>record;
    string st;
    //string st1;
    ll t;
    ll n, m;
    ll x, y;
    int i, j=1, k;
    ll a, b, c, d;
    int res = -1;
    int cnt = 0;
    int flag = 0;
    ll sum = 0;
    ll miv = MAX_INF,mav;
    cin>>n;
    cin>>st;
    if(n==1){
        cout<<'0'<<"\n";
        cout<<st<<"\n";
        return 0;
    }else if(n==2){
        if(st[0]==st[1]){
            if(st[0]=='B')
                st[1]='R';
            else if(st[0]=='G')
                st[1]='R';
            else
                st[1]='B';
            cnt++;
        }
        cout<<cnt<<"\n";
        cout<<st<<"\n";
        return 0;
    }
    else if(n>=3){
        For_nonequal(i, 0, n-2){
            if(st[i]==st[i+1]){
                if(st[i]=='B'&&st[i+2]=='B')
                    st[i+1]='G';
                else if(st[i]=='R'&&st[i+2]=='R')
                    st[i+1]='G';
                else if(st[i]=='G'&&st[i+2]=='G')
                    st[i+1]='B';
                else if(st[i]=='R'&&st[i+2]=='G')
                    st[i+1]='B';
                else if(st[i]=='R'&&st[i+2]=='B')
                    st[i+1]='G';
                else if(st[i]=='G'&&st[i+2]=='B')
                    st[i+1]='R';
                else if(st[i]=='G'&&st[i+2]=='R')
                    st[i+1]='B';
                else if(st[i]=='B'&&st[i+2]=='R')
                    st[i+1]='G';
                else if(st[i]=='B'&&st[i+2]=='G')
                    st[i+1]='R';
                cnt++;
            }
        }
        if(st[n-2]==st[n-1]){
            if(st[n-2]=='B')
                st[n-2]='R';
            else if(st[n-2]=='G')
                st[n-2]='R';
            else
                st[n-2]='B';
            cnt++;
        }
    }
    cout<<cnt<<"\n";
    cout<<st<<"\n";
    return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#define MAX_INF 0x3f3f3f
#define ll long long
#define ull unsigned long long
const int MAXN = 2e5+10;
const int MOD = 1e9+7;
using namespace std;
#define CLR(a, b) memset((a), (b),sizeof((a)))
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<ll>())
#define mnv(v) *min_element(v.begin(),v.end())
#define mxv(v) *max_element(v.begin(),v.end())
#define G_priority_queue(v, w) priority_queue<v, vector<v>, greater<v> > w
#define L_priority_queue(v, w) priority_queue<v, vector<v>, less<v> > w
#define For_equal(p ,s, e) for(p = s;p <= e;p++)
#define For_nonequal(p, s, e) for(p = s;p < e;p++)
//ll dp[MAXN];
ll ay[130];
//ll by[50005];

int main(){
    //unordered_map<ll, int> record;
    //map<int, string>record;
    string st;
    //string st1;
    ll t;
    ll n, m;
    ll x, y;
    int i, j=1, k;
    ll a, b, c, d;
    int res = -1;
    int cnt = 0;
    int flag = 0;
    ll sum = 0;
    ll miv = MAX_INF,mav;
    cin>>n;
    cin>>st;
    if(n==1){
        cout<<'0'<<"\n";
        cout<<st<<"\n";
        return 0;
    }else if(n==2){
        if(st[0]==st[1]){
            if(st[0]=='B')
                st[1]='R';
            else if(st[0]=='G')
                st[1]='R';
            else
                st[1]='B';
            cnt++;
        }
        cout<<cnt<<"\n";
        cout<<st<<"\n";
        return 0;
    }
    else if(n>=3){
        if(st[0]==st[1]){
            if(st[0]=='B')
                st[1]='R';
            else if(st[0]=='G')
                st[1]='R';
            else
                st[1]='B';
            cnt++;
        }
        For_nonequal(i, 1, n-2){
            if(st[i]==st[i+1]){
                if(st[i]=='B'&&st[i+2]=='B')
                    st[i+1]='G';
                else if(st[i]=='R'&&st[i+2]=='R')
                    st[i+1]='G';
                else if(st[i]=='G'&&st[i+2]=='G')
                    st[i+1]='B';
                else if(st[i]=='R'&&st[i+2]=='G')
                    st[i+1]='B';
                else if(st[i]=='R'&&st[i+2]=='B')
                    st[i+1]='G';
                else if(st[i]=='G'&&st[i+2]=='B')
                    st[i+1]='R';
                else if(st[i]=='G'&&st[i+2]=='R')
                    st[i+1]='B';
                else if(st[i]=='B'&&st[i+2]=='R')
                    st[i+1]='G';
                else if(st[i]=='B'&&st[i+2]=='G')
                    st[i+1]='R';
                cnt++;
            }
        }
        if(st[n-2]==st[n-1]){
            if(st[n-2]=='B')
                st[n-2]='R';
            else if(st[n-2]=='G')
                st[n-2]='R';
            else
                st[n-2]='B';
            cnt++;
        }
    }
    cout<<cnt<<"\n";
    cout<<st<<"\n";

    return 0;
}


#include<bits/stdc++.h>
#define r 'R'
#define g 'G'
#define b 'B'
#define INF 0x7FFFFFFF
using namespace std;

string s;
int n;

int main(){
	cin >> n;
	cin >> s;
	int sum = 0;
	char now = '\0';
	int no = 0;
	for(int i = 0; i < n; ++i){
		if(now == '\0' || s[i] == now){
			no++;
		}
		else{
			sum = sum + (no / 2);
			no = 1;
		}
		now = s[i];
		if(i == n - 1) sum = sum + (no / 2);
	}
	cout << sum << endl;
	now = '\0';
	no = 0;
	for(int i = 0; i < n; ++i){
		if(now == '\0' || s[i] == now){
			no++;
			now = s[i];
			if(no % 2 == 0){
				if(s[i - 1] != r && (i == n || s[i + 1] != r)) s[i] = r;
				else if(s[i - 1] != g && (i == n || s[i + 1] != g)) s[i] = g;
				else if(s[i - 1] != g && (i == n || s[i + 1] != g)) s[i] = b;
			}
		}
		else{
			now = s[i];
			no = 1;
		}
	}
	cout << s << endl;
	return 0;
}


#include<bits/stdc++.h>
#define r 'R'
#define g 'G'
#define b 'B'
#define INF 0x7FFFFFFF
using namespace std;

string s;
int n;

int main(){
	cin >> n;
	cin >> s;
	int sum = 0;
	char now = '\0';
	int no = 0;
	for(int i = 0; i < n; ++i){
		if(now == '\0' || s[i] == now){
			no++;
		}
		else{
			sum = sum + (no / 2);
			no = 1;
		}
		now = s[i];
		if(i == n - 1) sum = sum + (no / 2);
	}
	cout << sum << endl;
	now = '\0';
	no = 0;
	for(int i = 0; i < n; ++i){
		if(now == '\0' || s[i] == now){
			no++;
			if(no % 2 == 0){
				if(s[i - 1] != r && (i == n || s[i + 1] != r)) s[i] = r;
				else if(s[i - 1] != g && (i == n || s[i + 1] != g)) s[i] = g;
				else if(s[i - 1] != g && (i == n || s[i + 1] != g)) s[i] = b;
			}
		}
		else{
			no = 1;
		}
		now = s[i];
	}
	cout << s << endl;
	return 0;
}


#include<bits/stdc++.h>
#define r 'R'
#define g 'G'
#define b 'B'
#define INF 0x7FFFFFFF
using namespace std;

string s;
int n;

int main(){
	cin >> n;
	cin >> s;
	int sum = 0;
	char now = '\0';
	int no = 0;
	for(int i = 0; i < n; ++i){
		if(now == '\0' || s[i] == now){
			no++;
		}
		else{
			sum = sum + (no / 2);
			no = 1;
		}
		now = s[i];
		if(i == n - 1) sum = sum + (no / 2);
	}
	cout << sum << endl;
	now = '\0';
	for(int i = 0; i < n; ++i){
		if(now == '\0' || s[i] == now){
			no++;
			if(no % 2 == 0){
				if(s[i - 1] != r && (i == n || s[i + 1] != r)) s[i] = r;
				else if(s[i - 1] != g && (i == n || s[i + 1] != g)) s[i] = g;
				else if(s[i - 1] != g && (i == n || s[i + 1] != g)) s[i] = b;
			}
		}
		else{
			no = 1;
		}
		now = s[i];
	}
	cout << s << endl;
	return 0;
}


#include<bits/stdc++.h>
#define r 'R'
#define g 'G'
#define b 'B'
#define INF 0x7FFFFFFF
using namespace std;

string s;
int n;

int main(){
	cin >> n;
	cin >> s;
	int sum = 0;
	char now = '\0';
	int no = 0;
	for(int i = 0; i < n; ++i){
		if(now == '\0' || s[i] == now){
			no++;
		}
		else{
			sum = sum + (no / 2);
			no = 1;
		}
		now = s[i];
		if(i == n - 1) sum = sum + (no / 2);
	}
	cout << sum << endl;
	now = '\0';
	no = 0;
	for(int i = 0; i < n; ++i){
		if(now == '\0' || s[i] == now){
			no++;
			now = s[i];
			if(no % 2 == 0){
				if(s[i - 1] != r && (i == n || s[i + 1] != r)) s[i] = r;
				else if(s[i - 1] != g && (i == n || s[i + 1] != g)) s[i] = g;
				else if(s[i - 1] != g && (i == n || s[i + 1] != g)) s[i] = b;
			}
		}
		else{
			now = s[i]
			no = 1;
		}
	}
	cout << s << endl;
	return 0;
}


#include<bits/stdc++.h>
#define r 'R'
#define g 'G'
#define b 'B'
#define INF 0x7FFFFFFF
using namespace std;

string s;
int n;

int main(){
	cin >> n;
	cin >> s;
	int sum = 0;
	char now = '\0';
	int no = 0;
	for(int i = 0; i < n; ++i){
		if(now == '\0' || s[i] == now){
			no++;
		}
		else{
			sum = sum + (no / 2);
			no = 1;
		}
		now = s[i];
		if(i == n - 1) sum = sum + (no / 2);
	}
	cout << sum << endl;
	now = '\0';
	no = 0;
	for(int i = 0; i < n; ++i){
		if(now == '\0' || s[i] == now){
			no++;
			now = s[i];
			if(no % 2 == 0){
				if(s[i - 1] != r && (i == n || s[i + 1] != r)) s[i] = r;
				else if(s[i - 1] != g && (i == n || s[i + 1] != g)) s[i] = g;
				else if(s[i - 1] != b && (i == n || s[i + 1] != b)) s[i] = b;
			}
		}
		else{
			now = s[i];
			no = 1;
		}
	}
	cout << s << endl;
	return 0;
}


#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
long long n,z,x;
string s;
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin>>n;
    cin>>s;
    for(int i=0;i<n-1;i++){
      if(s[i]==s[i+1]){
        if(s[i]=='R' && s[i+2]=='G')s[i+1]='B';
        else if(s[i]=='B' && s[i+2]=='G')s[i+1]='R';
        else if(s[i]=='R' && s[i+2]=='B')s[i+1]='G';
        else {
            if(s[i]=='G')s[i+1]='B';
            if(s[i]=='B')s[i+1]='G';
            if(s[i]=='R')s[i+1]='G';
        }
        z++;
      }
    }
    cout<<z<<endl;
    cout<<s<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<db,db> pdb;

typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<string> vs;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<pdb> vpd;

#define mp make_pair
#define ff first
#define ss second
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define rall(x) (x).rbegin(), (x).rend()
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define vv <vector<vector> >
#define mp make_pair
#define str(a, b) substr((a), (b))
#define rr return
#define r0 return 0
#define mi map<int>
#define ms map<string>
#define ml map<ll>
#define all_sum(a,b) accumulate((a),(b),0)
#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
void adskiy_razgon(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};
ll nod(ll a, ll b) {
    if(b > a) {
        swap(a, b);
    }
    while(b > 0) {
        a %= b;
        swap(a, b);
    }
    return a;
}
ll nok(ll a,ll b) {
    return a * b / nod(a, b);
}
void sp(ll a,double b) {
    cout << fixed << setprecision(a) << b;
}
ll binpow (ll a, ll n) {
    if (n == 0) {
        return 1;
    }
    if (n % 2 == 1) {
        return binpow (a, n - 1) * a;
    }
    else {
        ll b = binpow (a, n / 2);
        return b * b;
    }
}

template<class A> void read(vector<A>& v);
template<class A, size_t S> void read(array<A, S>& a);
template<class T> void read(T& x) {
    cin >> x;
}
void read(double& d) {
    string t;
    read(t);
    d=stod(t);
}
void read(long double& d) {
    string t;
    read(t);
    d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
    read(t...);
}
template<class A> void read(vector<A>& x) {
    EACH(a, x)
        read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
    EACH(a, x)
        read(a);
}
string to_string(char c) {
    return string(1, c);
}
string to_string(bool b) {
    return b?"true":"false";
}
string to_string(const char* s) {
    return string(s);
}
string to_string(string s) {
    return s;
}
string to_string(vector<bool> v) {
    string res;
    FOR(sz(v))
        res+=char('0'+v[i]);
    return res;
}

template<size_t S> string to_string(bitset<S> b) {
    string res;
    FOR(S)
        res+=char('0'+b[i]);
    return res;
}
template<class T> string to_string(T v) {
    bool f=1;
    string res;
    EACH(x, v) {
        if(!f)
            res+=' ';
        f=0;
        res+=to_string(x);
    }
    return res;
}
template<class A> void write(A x) {
    cout << to_string(x);
}
template<class H, class... T> void write(const H& h, const T&... t) {
    write(h);
    write(t...);
}
void print() {
     write("\n");
}
template<class H, class... T> void print(const H& h, const T&... t) {
    write(h);
    if(sizeof...(t))
        write(' ');
    print(t...);
}

void yes(bool ok) {
    print((ok ? "YES" : "Yes"));
}
void no(bool ok) {
    print((ok ? "NO" : "No"));
}
const int MOD = 1e9+7; // 888244353;
const int N = 2e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);

void solve() {
    int n;
    read(n);
    string s;
    read(s);
    int ans = 0;
    for(int i = 0; i < n - 1; i++) {
        if(s[i] == s[i + 1]) {
            ans++;
            if(s[i] == s[i + 2]) {
                if(s[i] == 'R') s[i + 1] = 'B';
                else s[i + 1] = 'R';
            }
            else {
                if(s[i + 2] == 'R') {
                    if(s[i] == 'B') s[i + 1] = 'G';
                    else s[i + 1] = 'B';
                }
                else {
                    if(s[i] == 'B') s[i + 1] = 'G';
                    else s[i + 1] = 'R';
                }
            }
        }
    }
    print(ans);
    print(s);
}
int main(){
    adskiy_razgon();
    ll t = 1;
    //read(t);
    FOR(t) {
        //write("Case ", i, ": ");
        solve();
    }
    r0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<db,db> pdb;

typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<string> vs;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<pdb> vpd;

#define mp make_pair
#define ff first
#define ss second
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define rall(x) (x).rbegin(), (x).rend()
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define vv <vector<vector> >
#define mp make_pair
#define str(a, b) substr((a), (b))
#define rr return
#define r0 return 0
#define mi map<int>
#define ms map<string>
#define ml map<ll>
#define all_sum(a,b) accumulate((a),(b),0)
#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
void adskiy_razgon(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};
ll nod(ll a, ll b) {
    if(b > a) {
        swap(a, b);
    }
    while(b > 0) {
        a %= b;
        swap(a, b);
    }
    return a;
}
ll nok(ll a,ll b) {
    return a * b / nod(a, b);
}
void sp(ll a,double b) {
    cout << fixed << setprecision(a) << b;
}
ll binpow (ll a, ll n) {
    if (n == 0) {
        return 1;
    }
    if (n % 2 == 1) {
        return binpow (a, n - 1) * a;
    }
    else {
        ll b = binpow (a, n / 2);
        return b * b;
    }
}

template<class A> void read(vector<A>& v);
template<class A, size_t S> void read(array<A, S>& a);
template<class T> void read(T& x) {
    cin >> x;
}
void read(double& d) {
    string t;
    read(t);
    d=stod(t);
}
void read(long double& d) {
    string t;
    read(t);
    d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
    read(t...);
}
template<class A> void read(vector<A>& x) {
    EACH(a, x)
        read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
    EACH(a, x)
        read(a);
}
string to_string(char c) {
    return string(1, c);
}
string to_string(bool b) {
    return b?"true":"false";
}
string to_string(const char* s) {
    return string(s);
}
string to_string(string s) {
    return s;
}
string to_string(vector<bool> v) {
    string res;
    FOR(sz(v))
        res+=char('0'+v[i]);
    return res;
}

template<size_t S> string to_string(bitset<S> b) {
    string res;
    FOR(S)
        res+=char('0'+b[i]);
    return res;
}
template<class T> string to_string(T v) {
    bool f=1;
    string res;
    EACH(x, v) {
        if(!f)
            res+=' ';
        f=0;
        res+=to_string(x);
    }
    return res;
}
template<class A> void write(A x) {
    cout << to_string(x);
}
template<class H, class... T> void write(const H& h, const T&... t) {
    write(h);
    write(t...);
}
void print() {
     write("\n");
}
template<class H, class... T> void print(const H& h, const T&... t) {
    write(h);
    if(sizeof...(t))
        write(' ');
    print(t...);
}

void yes(bool ok) {
    print((ok ? "YES" : "Yes"));
}
void no(bool ok) {
    print((ok ? "NO" : "No"));
}
const int MOD = 1e9+7; // 888244353;
const int N = 2e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);

void solve() {
    int n;
    read(n);
    string s;
    read(s);
    int ans = 0;
    for(int i = 0; i < n - 1; i++) {
        if(s[i] == s[i + 1]) {
            ans++;
            if(s[i] == s[i + 2]) {
                if(s[i] == 'R') s[i + 1] = 'B';
                else s[i + 1] = 'R';
            }
            else {
                if(s[i + 2] == 'R') {
                    if(s[i] == 'B') s[i + 1] = 'G';
                    else s[i + 1] = 'B';
                }
                else {
                    if(s[i] == 'R') s[i + 1] = 'G';
                    else s[i + 1] = 'R';
                }
            }
        }
    }
    print(ans);
    print(s);
}
int main(){
    adskiy_razgon();
    ll t = 1;
    //read(t);
    FOR(t) {
        //write("Case ", i, ": ");
        solve();
    }
    r0;
}


#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<db,db> pdb;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<string> vs;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<pdb> vdb;
#define mp make_pair
#define ff first
#define ss second
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define rall(x) (x).rbegin(), (x).rend()
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define pp pop_back
#define lb lower_bound
#define ub upper_bound
#define vv <vector<vector> >
#define mp make_pair
#define str(a, b) substr((a), (b))
#define rr return
#define r0 return 0
#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
void adskiy_razgon(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const int dxo[8] = {-1, -1, -1, 0, 1, 1, 1, 0}, dyo[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

void sp(ll a,double b) {
    cout << fixed << setprecision(a) << b;
}
template<class A> void read(vector<A>& v);
template<class A, size_t S> void read(array<A, S>& a);
template<class T> void read(T& x) {
    cin >> x;
}
void read(double& d) {
    string t;
    read(t);
    d=stod(t);
}
void read(long double& d) {
    string t;
    read(t);
    d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
    read(t...);
}
template<class A> void read(vector<A>& x) {
    EACH(a, x) read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
    EACH(a, x) read(a);
}
string to_string(char c) {
    return string(1, c);
}
string to_string(const char* s) {
    return string(s);
}
string to_string(string s) {
    return s;
}
string to_string(vector<bool> v) {
    string res;
    FOR(sz(v)) res += char('0' + v[i]);
    return res;
}
template<size_t S> string to_string(bitset<S> b) {
    string res;
    FOR(S) res += char('0' + b[i]);
    return res;
}
template<class T> string to_string(T v) {
    bool f=1;
    string res;
    EACH(x, v) {
        if(!f) res += ' ';
        f = 0;
        res += to_string(x);
    }
    return res;
}
template<class A> void write(A x) {
    cout << to_string(x);
}
inline int bitCount(int number) {
    return __builtin_popcount(number);
}
inline int bitCount(ll number) {
    return __builtin_popcount(number);
}
template<class H, class... T> void write(const H& h, const T&... t) {
    write(h);
    write(t...);
}
void print() {
     write("\n");
}
template<class H, class... T> void print(const H& h, const T&... t) {
    write(h);
    if(sizeof...(t)) write(' ');
    print(t...);
}
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
void yes(bool ok) {
    print((ok ? "YES" : "Yes"));
}
void no(bool ok) {
    print((ok ? "NO" : "No"));
}
const int MOD = 1e9 ; // 888244353;
const int N = 2e5+1;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const int M = 100;
ll binpow (ll a, ll n) {
    if (n == 0) return 1;
    if (n % 2 == 1) return ((binpow (a, n - 1) % MOD) * a) % MOD;
    else {
        ll b = (binpow (a, n / 2) % MOD);
        return (b * b) % MOD;
    }
}

void solve() {
    int n;
    string s;
    read(n, s);
    int ans = 0;
    s += '#';
    for(int i = 0; i < n - 1; ++i) {
        if(s[i] == s[i + 1]) {
            ans++;
            if(s[i] == s[i + 2]) {
                if(s[i] == 'B') s[i + 1] = 'R';
                else s[i + 1] = 'B';
            }
            else {
                if(s[i] == 'B') {
                    if(s[i + 2] == 'R') s[i + 1] = 'G';
                    else s[i + 1] = 'R';
                }
                else if(s[i] == 'R') {
                    if(s[i + 2] == 'B') s[i + 1] = 'G';
                    else s[i + 1] = 'B';
                }
                else {
                    if(s[i + 2] == 'R') s[i + 1] = 'B';
                    else s[i + 1] = 'R';
                }
            }
        }
    }
    s.erase(s.begin() + sz(s) - 1);
    print(ans);
    print(s);
}
int main(){
    adskiy_razgon();
    ll t = 1;
    //read(t);
    FOR(t) {
        //write("Case ", i, ": ");
        solve();
    }
    r0;
}
/*

*/


#include<bits/stdc++.h>
using namespace std;

const int maxn=2e5+25;
int n;
string s;
int dp[3][maxn];
int path[3][maxn];

void pri(int k)
{
    printf("%d\n",dp[k][--n]);
    string ans;
    while(n>=0)
    {
        if(k==0)    ans.push_back('R');
        else if(k==1)   ans.push_back('B');
        else ans.push_back('G');
        k=path[k][n--];
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}

int solve()
{
    for(int i=1;i<n;i++)
    {
        for(int cur=0;cur<3;cur++)
        {
            for(int prev=0;prev<3;prev++)
            {
                if(prev!=cur)
                {
                    int cost=dp[prev][i-1]+(cur!=s[i]);
                    if(dp[cur][i]==-1||dp[cur][i]>cost)
                    {
                        dp[cur][i]=cost;
                        path[cur][i]=prev;
                    }
                }
            }
        }
    }
    int most=0;
    for(int i=1;i<3;i++)
        if(dp[i][n-1]<dp[most][n-1])
            most=i;
    pri(most);
}

void ini()
{
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<3;i++)
        {dp[i][0]=1;}
    dp[s[0]][0]=0;
}

void standard()
{
   for(char &q:s)
   {
       if(q=='R')   q=0;
       else if(q=='B')  q=1;
       else q=2;
   }
}
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>s;
    standard();
    ini();
    solve();
   // system("pause");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int maxn=2e5+25;
int n;
string s;
int dp[3][maxn];
int path[3][maxn];

void pri(int k)
{
    printf("%d\n",dp[k][--n]);
    string ans;
    while(n>=0)
    {
        if(k==0)    ans.push_back('R');
        else if(k==1)   ans.push_back('B');
        else ans.push_back('G');
        k=path[k][n--];
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}

int solve()
{
    for(int i=1;i<n;i++)
    {
        for(int cur=0;cur<3;cur++)
        {
            for(int prev=0;prev<3;prev++)
            {
                if(prev!=cur)
                {
                    int cost=dp[prev][i-1]+(cur!=s[i]);
                    if(dp[cur][i]==-1||dp[cur][i]>cost)
                    {
                        dp[cur][i]=cost;
                        path[cur][i]=prev;
                    }
                }
            }
        }
    }
    int most=0;
    for(int i=1;i<3;i++)
        if(dp[i][n-1]<dp[most][n-1])
            most=i;
    pri(most);
}

void ini()
{
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<3;i++)
        {dp[i][0]=1;}
    dp[s[0]][0]=0;
}

void standard()
{
   for(char &q:s)
   {
       if(q=='R')   q=0;
       else if(q=='B')  q=1;
       else q=2;
   }
}
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>s;
    standard();
    ini();
    solve();
    //system("pause");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int maxn = 2e5 + 25;
int n;
string s;
int dp[3][maxn];
int path[3][maxn];

void print(int k)
{
		printf("%d\n", dp[k][--n]);
		string ans;
		while (n >= 0)
		{
				if (k == 0)    ans.push_back('R');
				else if (k == 1)   ans.push_back('B');
				else ans.push_back('G');
				k = path[k][n--];
		}
		reverse(ans.begin(), ans.end());
		cout << ans << endl;
}

void solve()
{
		for (int i = 1; i < n; i++)
		{
				for (int cur = 0; cur < 3; cur++)
				{
						for (int prev = 0; prev < 3; prev++)
						{
								if (prev != cur)
								{
										int cost = dp[prev][i - 1] + (cur != s[i]);
										if (dp[cur][i] == -1 || dp[cur][i] > cost)
										{
												dp[cur][i] = cost;
												path[cur][i] = prev;
										}
								}
						}
				}
		}
		int most = 0;
		for (int i = 1; i < 3; i++)
				if (dp[i][n - 1] < dp[most][n - 1])
						most = i;
		print(most);
}

void ini()
{
		memset(dp, -1, sizeof(dp));
		for (int i = 0; i < 3; i++)
				dp[i][0] = 1;
		dp[s[0]][0] = 0;
}

void standard()
{
		for (char &q : s)
		{
				if (q == 'R')   q = 0;
				else if (q == 'B')  q = 1;
				else q = 2;
		}
}
int main()
{
		ios::sync_with_stdio(false);
		cin >> n >> s;
		standard();
		ini();
		solve();
		//system("pause");
		return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int maxn=2e5+25;
int n;
string s;
int dp[3][maxn];
int path[3][maxn];

void pri(int k)
{
    printf("%d\n",dp[k][--n]);
    string ans;
    while(n>=0)
    {
        if(k==0)    ans.push_back('R');
        else if(k==1)   ans.push_back('B');
        else ans.push_back('G');
        k=path[k][n--];
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}

int solve()
{
    for(int i=1;i<n;i++)
    {
        for(int cur=0;cur<3;cur++)
        {
            for(int prev=0;prev<3;prev++)
            {
                if(prev!=cur)
                {
                    int cost=dp[prev][i-1]+(cur!=s[i]);
                    if(dp[cur][i]==-1||dp[cur][i]>cost)
                    {
                        dp[cur][i]=cost;
                        path[cur][i]=prev;
                    }
                }
            }
        }
    }
    int most=0;
    for(int i=1;i<3;i++)
        if(dp[i][n-1]<dp[most][n-1])
            most=i;
    pri(most);
}

void ini()
{
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<3;i++)
        {dp[i][0]=1;}
    dp[s[0]][0]=0;
}

void standard()
{
   for(char &q:s)
   {
       if(q=='R')   q=0;
       else if(q=='B')  q=1;
       else q=2;
   }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>s;
    standard();
    ini();
    solve();
   // system("pause");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int maxn = 2e5 + 25;
int n;
string s;
int dp[3][maxn];
int path[3][maxn];

void print(int k)
{
		printf("%d\n", dp[k][--n]);
		printf("1\n");
		string ans;
		while (n >= 0)
		{
				if (k == 0)    ans.push_back('R');
				else if (k == 1)   ans.push_back('B');
				else ans.push_back('G');
				k = path[k][n--];
		}
		reverse(ans.begin(), ans.end());
		cout << ans << endl;
		printf("2\n");
}

void solve()
{
		for (int i = 1; i < n; i++)
		{
				for (int cur = 0; cur < 3; cur++)
				{
						for (int prev = 0; prev < 3; prev++)
						{
								if (prev != cur)
								{
										int cost = dp[prev][i - 1] + (cur != s[i]);
										if (dp[cur][i] == -1 || dp[cur][i] > cost)
										{
												dp[cur][i] = cost;
												path[cur][i] = prev;
										}
								}
						}
				}
		}
		int most = 0;
		for (int i = 1; i < 3; i++)
				if (dp[i][n - 1] < dp[most][n - 1])
						most = i;
		print(most);
}

void ini()
{
		memset(dp, -1, sizeof(dp));
		for (int i = 0; i < 3; i++)
				dp[i][0] = 1;
		dp[s[0]][0] = 0;
}

void standard()
{
		for (char &q : s)
		{
				if (q == 'R')   q = 0;
				else if (q == 'B')  q = 1;
				else q = 2;
		}
}
int main()
{
		ios::sync_with_stdio(false);
		cin >> n >> s;
		standard();
		ini();
		solve();
		//system("pause");
		return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int maxn=2e5+25;
int n;
string s;
int dp[3][maxn];
int path[3][maxn];

void pri(int k)
{
    printf("%d\n",dp[k][--n]);
    string ans;
    while(n>=0)
    {
        if(k==0)    ans.push_back('R');
        else if(k==1)   ans.push_back('B');
        else ans.push_back('G');
        k=path[k][n--];
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}

int solve()
{
    for(int i=1;i<n;i++)
    {
        for(int cur=0;cur<3;cur++)
        {
            for(int prev=0;prev<3;prev++)
            {
                if(prev!=cur)
                {
                    int cost=dp[prev][i-1]+(cur!=s[i]);
                    if(dp[cur][i]==-1||dp[cur][i]>cost)
                    {
                        dp[cur][i]=cost;
                        path[cur][i]=prev;
                    }
                }
            }
        }
    }
    int most=0;
    for(int i=1;i<3;i++)
        if(dp[i][n-1]<dp[most][n-1])
            most=i;
    pri(most);
}

void ini()
{
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<3;i++)
        {dp[i][0]=1;}
    dp[s[0]][0]=0;
}

void standard()
{
   for(char &q:s)
   {
       if(q=='R')   q=0;
       else if(q=='B')  q=1;
       else q=2;
   }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>s;
    standard();
    ini();
    solve();
   // system("pause");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int maxn=2e5+25;
int n;
string s;
int dp[3][maxn];
int path[3][maxn];

void pri(int k)
{
    printf("%d\n",dp[k][--n]);
    string ans;
    while(n>=0)
    {
        if(k==0)    ans.push_back('R');
        else if(k==1)   ans.push_back('B');
        else ans.push_back('G');
        k=path[k][n--];
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}

int solve()
{
    for(int i=1;i<n;i++)
    {
        for(int cur=0;cur<3;cur++)
        {
            for(int prev=0;prev<3;prev++)
            {
                if(prev!=cur)
                {
                    int cost=dp[prev][i-1]+(cur!=s[i]);
                    if(dp[cur][i]==-1||dp[cur][i]>cost)
                    {
                        dp[cur][i]=cost;
                        path[cur][i]=prev;
                    }
                }
            }
        }
    }
    int most=0;
    for(int i=1;i<3;i++)
        if(dp[i][n-1]<dp[most][n-1])
            most=i;
    pri(most);
}

void ini()
{
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<3;i++)
        {dp[i][0]=1;}
    dp[s[0]][0]=0;
}

void standard()
{
   for(char &q:s)
   {
       if(q=='R')   q=0;
       else if(q=='B')  q=1;
       else q=2;
   }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tiie(NULL);
    cin>>n>>s;
    standard();
    ini();
    solve();
    //system("pause");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int maxn=2e5+25;
int n;
string s;
int dp[3][maxn];
int path[3][maxn];

void pri(int k)
{
    printf("%d\n",dp[k][--n]);
    string ans;
    while(n>=0)
    {
        if(k==0)    ans.push_back('R');
        else if(k==1)   ans.push_back('B');
        else ans.push_back('G');
        k=path[k][n--];
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}

int solve()
{
    for(int i=1;i<n;i++)
    {
        for(int cur=0;cur<3;cur++)
        {
            for(int prev=0;prev<3;prev++)
            {
                if(prev!=cur)
                {
                    int cost=dp[prev][i-1]+(cur!=s[i]);
                    if(dp[cur][i]==-1||dp[cur][i]>cost)
                    {
                        dp[cur][i]=cost;
                        path[cur][i]=prev;
                    }
                }
            }
        }
    }
    int most=0;
    for(int i=1;i<3;i++)
        if(dp[i][n-1]<dp[most][n-1])
            most=i;
    pri(most);
}

void ini()
{
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<3;i++)
        {dp[i][0]=1;}
    dp[s[0]][0]=0;
}

void standard()
{
   for(char &q:s)
   {
       if(q=='R')   q=0;
       else if(q=='B')  q=1;
       else q=2;
   }
}
int main()
{
    //ios::sync_with_stdio(false);
    cin>>n>>s;
    standard();
    ini();
    solve();
    //system("pause");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int maxn=2e5+25;
int n;
string s;
int dp[3][maxn];
int path[3][maxn];

void pri(int k)
{
   // printf("%d\n",dp[k][--n]);
   cout<<dp[k][--n]<<endl;
    string ans;
    while(n>=0)
    {
        if(k==0)    ans.push_back('R');
        else if(k==1)   ans.push_back('B');
        else ans.push_back('G');
        k=path[k][n--];
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}

int solve()
{
    for(int i=1;i<n;i++)
    {
        for(int cur=0;cur<3;cur++)
        {
            for(int prev=0;prev<3;prev++)
            {
                if(prev!=cur)
                {
                    int cost=dp[prev][i-1]+(cur!=s[i]);
                    if(dp[cur][i]==-1||dp[cur][i]>cost)
                    {
                        dp[cur][i]=cost;
                        path[cur][i]=prev;
                    }
                }
            }
        }
    }
    int most=0;
    for(int i=1;i<3;i++)
        if(dp[i][n-1]<dp[most][n-1])
            most=i;
    pri(most);
}

void ini()
{
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<3;i++)
        {dp[i][0]=1;}
    dp[s[0]][0]=0;
}

void standard()
{
   for(char &q:s)
   {
       if(q=='R')   q=0;
       else if(q=='B')  q=1;
       else q=2;
   }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>s;
    standard();
    ini();
    solve();
    //system("pause");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int maxn=2e5+25;
int n;
string s;
int dp[3][maxn];
int path[3][maxn];

void pri(int k)
{
    printf("%d\n",dp[k][--n]);
    string ans;
    while(n>=0)
    {
        if(k==0)    ans.push_back('R');
        else if(k==1)   ans.push_back('B');
        else ans.push_back('G');
        k=path[k][n--];
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}

int solve()
{
    for(int i=1;i<n;i++)
    {
        for(int cur=0;cur<3;cur++)
        {
            for(int prev=0;prev<3;prev++)
            {
                if(prev!=cur)
                {
                    int cost=dp[prev][i-1]+(cur!=s[i]);
                    if(dp[cur][i]==-1||dp[cur][i]>cost)
                    {
                        dp[cur][i]=cost;
                        path[cur][i]=prev;
                    }
                }
            }
        }
    }
    int most=0;
    for(int i=1;i<3;i++)
        if(dp[i][n-1]<dp[most][n-1])
            most=i;
    pri(most);
}

void ini()
{
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<3;i++)
        {dp[i][0]=1;}
    dp[s[0]][0]=0;
}

void standard()
{
   for(char &q:s)
   {
       if(q=='R')   q=0;
       else if(q=='B')  q=1;
       else q=2;
   }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>s;
    standard();
    ini();
    solve();
    //system("pause");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int maxn=2e5+25;
int n;
string s;
int dp[3][maxn];
int path[3][maxn];

void pri(int k)
{
    printf("%d\n",dp[k][--n]);
    string ans;
    while(n>=0)
    {
        if(k==0)    ans.push_back('R');
        else if(k==1)   ans.push_back('B');
        else ans.push_back('G');
        k=path[k][n--];
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}

int solve()
{
    for(int i=1;i<n;i++)
    {
        for(int cur=0;cur<3;cur++)
        {
            for(int prev=0;prev<3;prev++)
            {
                if(prev!=cur)
                {
                    int cost=dp[prev][i-1]+(cur!=s[i]);
                    if(dp[cur][i]==-1||dp[cur][i]>cost)
                    {
                        dp[cur][i]=cost;
                        path[cur][i]=prev;
                    }
                }
            }
        }
    }
    int most=0;
    for(int i=1;i<3;i++)
        if(dp[i][n-1]<dp[most][n-1])
            most=i;
    pri(most);
}

void ini()
{
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<3;i++)
        {dp[i][0]=1;}
    dp[s[0]][0]=0;
}

void standard()
{
   for(char &q:s)
   {
       if(q=='R')   q=0;
       else if(q=='B')  q=1;
       else q=2;
   }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>s;
    standard();
    ini();
    solve();
   // system("pause");
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n ;
    char s[200000];
    char result[200000];
    int index=0;
    int sum=219;
    int changes=0;
    int changesI=0;
    char invert[200000];
    //cout<<"R = "<<int('R')<<endl<<"G = " <<int('G')<<endl<<"B = "<<int('B')<<endl;

    cin >> n >> s ;
    for(int i=0;i<n;i++)
    {
        invert[i]=s[n-i-1];
    }

    for(int i=0 ; i<n ; i++)
    {
        sum = 219;

        if(s[i]==s[i+1])
        {
            result[index]=s[i];
            index++;
            sum-=s[i];
            if(s[i]==s[i+2]||i==n-2)
            {
                if(sum==153 || sum==148)
                {
                    result[index]='R';
                    index++;
                }
                else
                {
                    result[index]='B';
                    index++;
                }
            }
            else
            {
                sum-=s[i+2];
                result[index]=char(sum);
                index++;
            }
            changes++;
            i++;
        }
        else
        {
            result[index]=s[i];
            index++;
        }

    }
    index=0;
    for(int i=0 ; i<n ; i++)
    {
        sum = 219;

        if(invert[i]==invert[i+1])
        {
            result[index]=invert[i];
            index++;
            sum-=invert[i];
            if(invert[i]==invert[i+2]||i==n-2)
            {
                if(sum==153 || sum==148)
                {
                    result[index]='R';
                    index++;
                }
                else
                {
                    result[index]='B';
                    index++;
                }
            }
            else
            {
                sum-=invert[i+2];
                result[index]=char(sum);
                index++;
            }
            changesI++;
            i++;
        }
        else
        {
            result[index]=invert[i];
            index++;
        }

    }

    if(changes<=changesI)
    {
        cout << changes << endl << result;
    }
    else
    {
        cout << changesI << endl << invert ;
    }

}


#include <iostream>

using namespace std;

int main()
{
    int n ;
    char s[200000];
    char result[200000];
    char result2[200000]
    int index=0;
    int sum=219;
    int changes=0;
    int changesI=0;
    char invert[200000];
    //cout<<"R = "<<int('R')<<endl<<"G = " <<int('G')<<endl<<"B = "<<int('B')<<endl;

    cin >> n >> s ;
    for(int i=0;i<n;i++)
    {
        invert[i]=s[n-i-1];
    }

    for(int i=0 ; i<n ; i++)
    {
        sum = 219;

        if(s[i]==s[i+1])
        {
            result[index]=s[i];
            index++;
            sum-=s[i];
            if(s[i]==s[i+2]||i==n-2)
            {
                if(sum==153 || sum==148)
                {
                    result[index]='R';
                    index++;
                }
                else
                {
                    result[index]='B';
                    index++;
                }
            }
            else
            {
                sum-=s[i+2];
                result[index]=char(sum);
                index++;
            }
            changes++;
            i++;
        }
        else
        {
            result[index]=s[i];
            index++;
        }

    }
    index=0;
    for(int i=0 ; i<n ; i++)
    {
        sum = 219;

        if(invert[i]==invert[i+1])
        {
            result2[index]=invert[i];
            index++;
            sum-=invert[i];
            if(invert[i]==invert[i+2]||i==n-2)
            {
                if(sum==153 || sum==148)
                {
                    result2[index]='R';
                    index++;
                }
                else
                {
                    result2[index]='B';
                    index++;
                }
            }
            else
            {
                sum-=invert[i+2];
                result2[index]=char(sum);
                index++;
            }
            changesI++;
            i++;
        }
        else
        {
            result2[index]=invert[i];
            index++;
        }

    }

    if(changes<=changesI)
    {
        cout << changes << endl << result;
    }
    else
    {
        cout << changesI << endl << result2 ;
    }

}


#include <iostream>

using namespace std;

int main()
{
    int n ;
    char s[200001];
    char result[200001];
    int index=0;
    int sum=219;
    int changes=0;

    //cout<<"R = "<<int('R')<<endl<<"G = " <<int('G')<<endl<<"B = "<<int('B')<<endl;

    cin >> n >> s ;

    for(int i=0 ; i<n ; i++)
    {
        sum = 219;

        if(s[i]==s[i+1])
        {
            result[index]=s[i];
            index++;
            sum-=s[i];
            if(s[i]==s[i+2]||i==n-2)
            {
                if(sum==153 || sum==148)
                {
                    result[index]='R';
                    index++;
                }
                else
                {
                    result[index]='B';
                    index++;
                }
            }
            else
            {
                sum-=s[i+2];
                result[index]=char(sum);
                index++;
            }
            changes++;
            i++;
        }
        else
        {
            result[index]=s[i];
            index++;
        }

    }

    cout << changes << endl << result;

}


#include <iostream>

using namespace std;

int main()
{
    int n ;
    char s[200000];
    char result[200000];
    char result2[200000];
    int index=0;
    int sum=219;
    int changes=0;
    int changesI=0;
    char invert[200000];
    //cout<<"R = "<<int('R')<<endl<<"G = " <<int('G')<<endl<<"B = "<<int('B')<<endl;

    cin >> n >> s ;
    for(int i=0;i<n;i++)
    {
        invert[i]=s[n-i-1];
    }

    for(int i=0 ; i<n ; i++)
    {
        sum = 219;

        if(s[i]==s[i+1])
        {
            result[index]=s[i];
            index++;
            sum-=s[i];
            if(s[i]==s[i+2]||i==n-2)
            {
                if(sum==153 || sum==148)
                {
                    result[index]='R';
                    index++;
                }
                else
                {
                    result[index]='B';
                    index++;
                }
            }
            else
            {
                sum-=s[i+2];
                result[index]=char(sum);
                index++;
            }
            changes++;
            i++;
        }
        else
        {
            result[index]=s[i];
            index++;
        }

    }
    index=0;
    for(int i=0 ; i<n ; i++)
    {
        sum = 219;

        if(invert[i]==invert[i+1])
        {
            result2[index]=invert[i];
            index++;
            sum-=invert[i];
            if(invert[i]==invert[i+2]||i==n-2)
            {
                if(sum==153 || sum==148)
                {
                    result2[index]='R';
                    index++;
                }
                else
                {
                    result2[index]='B';
                    index++;
                }
            }
            else
            {
                sum-=invert[i+2];
                result2[index]=char(sum);
                index++;
            }
            changesI++;
            i++;
        }
        else
        {
            result2[index]=invert[i];
            index++;
        }

    }

    if(changes<=changesI)
    {
        cout << changes << endl << result;
    }
    else
    {
        cout << changesI << endl << result2 ;
    }

}


#include <iostream>

using namespace std;

int main()
{
    int n ;
    char s[200000];
    char result[200000];
    int index=0;
    int sum=219;
    int changes=0;
    //cout<<"R = "<<int('R')<<endl<<"G = " <<int('G')<<endl<<"B = "<<int('B')<<endl;

    cin >> n >> s ;

    if(n==1)
    {
        cout<<"0\n"<<s;
        return 0;
    }
    for(int i=0 ; i<n ; i++)
    {
        sum = 219;

        if(s[i]==s[i+1])
        {
            result[index]=s[i];
            index++;
            sum-=s[i];
            if(s[i]==s[i+2]||i==n-2)
            {
                if(sum==153 || sum==148)
                {
                    result[index]='R';
                    index++;
                }
                else
                {
                    result[index]='B';
                    index++;
                }
            }
            else
            {
                sum-=s[i+2];
                result[index]=char(sum);
                index++;
            }
            changes++;
            i++;
        }
        else
        {
            result[index]=s[i];
            index++;
        }

    }

    cout<<changes<<endl;

    cout << result;

}


#include <iostream>

using namespace std;

int main()
{
    int n ;
    char s[200000];
    char result[200000];
    int index=0;
    int sum=219;
    int changes=0;
    //cout<<"R = "<<int('R')<<endl<<"G = " <<int('G')<<endl<<"B = "<<int('B')<<endl;

    cin >> n >> s ;

    for(int i=0 ; i<n ; i++)
    {
        sum = 219;

        if(s[i]==s[i+1])
        {
            result[index]=s[i];
            index++;
            sum-=s[i];
            if(s[i]==s[i+2]||i==n-2)
            {
                if(sum==153 || sum==148)
                {
                    result[index]='R';
                    index++;
                }
                else
                {
                    result[index]='B';
                    index++;
                }
            }
            else
            {
                sum-=s[i+2];
                result[index]=char(sum);
                index++;
            }
            changes++;
            i++;
        }
        else
        {
            result[index]=s[i];
            index++;
        }

    }

    cout<<changes<<endl;

    cout << result;

}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;

#define ll long long
#define E 1000000007LL
#define w(x) cout << (#x) << "=" << x << endl

int main() {
	ios::sync_with_stdio(false);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int n; cin >> n;
	string s; cin >> s;
	int patches = 0;
	for (int i = 1; i < n - 1; i++) {
		char curr = s[i];
		char prev = s[i - 1];
		char next = s[i + 1];
		if (curr == prev || curr == next) {
			if (prev == 'R') {
				if (next == 'R')
					curr = 'B';
				if (next == 'B')
					curr = 'G';
				if (next == 'G')
					curr = 'B';
			}
			if (prev == 'B') {
				if (next == 'R')
					curr = 'G';
				if (next == 'B')
					curr = 'R';
				if (next == 'G')
					curr = 'R';
			}
			if (prev == 'G') {
				if (next == 'R')
					curr = 'B';
				if (next == 'B')
					curr = 'R';
				if (next == 'G')
					curr = 'B';
			}
			s[i] = curr;
			patches++;
		}
	}

	cout << patches << endl;
	cout << s << endl;

#ifdef _DEBUG
	system("pause");
	while (true);
#endif
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;

#define ll long long
#define E 1000000007LL
#define w(x) cout << (#x) << "=" << x << endl

int main() {
	ios::sync_with_stdio(false);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int n; cin >> n;
	string s; cin >> s;
	int patches = 0;
	for (int i = 1; i < n; i++) {
		char curr = s[i];
		char prev = s[i - 1];
		char next = (i + 1 < n ? s[i + 1] : '_');

		if (curr == prev) {
			if (prev == 'R') {
				if (next == 'R')
					curr = 'B';
				if (next == 'B')
					curr = 'G';
				if (next == 'G')
					curr = 'B';
				if (next == '_')
					curr = 'G';
			}
			if (prev == 'B') {
				if (next == 'R')
					curr = 'G';
				if (next == 'B')
					curr = 'R';
				if (next == 'G')
					curr = 'R';
				if (next == '_')
					curr = 'G';
			}
			if (prev == 'G') {
				if (next == 'R')
					curr = 'B';
				if (next == 'B')
					curr = 'R';
				if (next == 'G')
					curr = 'B';
				if (next == '_')
					curr = 'A';
			}
			s[i] = curr;
			patches++;
		}
	}

	cout << patches << endl;
	cout << s << endl;

#ifdef _DEBUG
	cout << "\nProgram finished.\n";
	while (true);
#endif
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;

#define ll long long
#define E 1000000007LL
#define w(x) cout << (#x) << "=" << x << endl

int main() {
	ios::sync_with_stdio(false);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int n; cin >> n;
	string s; cin >> s;
	int patches = 0;
	for (int i = 1; i < n; i++) {
		char curr = s[i];
		char prev = s[i - 1];
		char next = (i + 1 < n ? s[i + 1] : '_');

		if (curr == prev) {
			if (prev == 'R') {
				if (next == 'R')
					curr = 'B';
				if (next == 'B')
					curr = 'G';
				if (next == 'G')
					curr = 'B';
				if (next == '_')
					curr = 'G';
			}
			if (prev == 'B') {
				if (next == 'R')
					curr = 'G';
				if (next == 'B')
					curr = 'R';
				if (next == 'G')
					curr = 'R';
				if (next == '_')
					curr = 'G';
			}
			if (prev == 'G') {
				if (next == 'R')
					curr = 'B';
				if (next == 'B')
					curr = 'R';
				if (next == 'G')
					curr = 'B';
				if (next == '_')
					curr = 'R';
			}
			s[i] = curr;
			patches++;
		}
	}

	cout << patches << endl;
	cout << s << endl;

#ifdef _DEBUG
	cout << "\nProgram finished.\n";
	while (true);
#endif
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;

#define ll long long
#define E 1000000007LL
#define w(x) cout << (#x) << "=" << x << endl

int main() {
	ios::sync_with_stdio(false);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int n; cin >> n;
	string s; cin >> s;
	int patches = 0;
	for (int i = 1; i < n; i++) {
		char curr = s[i];
		char prev = s[i - 1];
		char next = (i + 1 < n ? s[i + 1] : '_');

		if (curr == prev) {
			if (prev == 'R') {
				if (next == 'R')
					curr = 'B';
				if (next == 'B')
					curr = 'G';
				if (next == 'G')
					curr = 'B';
			}
			if (prev == 'B') {
				if (next == 'R')
					curr = 'G';
				if (next == 'B')
					curr = 'R';
				if (next == 'G')
					curr = 'R';
			}
			if (prev == 'G') {
				if (next == 'R')
					curr = 'B';
				if (next == 'B')
					curr = 'R';
				if (next == 'G')
					curr = 'B';
			}
			s[i] = curr;
			patches++;
		}
	}

	cout << patches << endl;
	cout << s << endl;

#ifdef _DEBUG
	cout << "\nProgram finished.\n";
	while (true);
#endif
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;

#define ll long long
#define E 1000000007LL
#define w(x) cout << (#x) << "=" << x << endl

int main() {
	ios::sync_with_stdio(false);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int n; cin >> n;
	string s; cin >> s;
	int patches = 0;
	assert(s != "RBGRRBRGG");
	for (int i = 1; i < n; i++) {
		char curr = s[i];
		char prev = s[i - 1];
		char next = (i + 1 < n ? s[i + 1] : '_');

		if (curr == prev) {
			if (prev == 'R') {
				if (next == 'R')
					curr = 'B';
				if (next == 'B')
					curr = 'G';
				if (next == 'G')
					curr = 'B';
				if (next == '_')
					curr = 'G';
			}
			if (prev == 'B') {
				if (next == 'R')
					curr = 'G';
				if (next == 'B')
					curr = 'R';
				if (next == 'G')
					curr = 'R';
				if (next == '_')
					curr = 'G';
			}
			if (prev == 'G') {
				if (next == 'R')
					curr = 'B';
				if (next == 'B')
					curr = 'R';
				if (next == 'G')
					curr = 'B';
				if (next == '_')
					curr = 'A';
			}
			s[i] = curr;
			patches++;
		}
	}

	cout << patches << endl;
	cout << s << endl;

#ifdef _DEBUG
	cout << "\nProgram finished.\n";
	while (true);
#endif
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;

#define ll long long
#define E 1000000007LL
#define w(x) cout << (#x) << "=" << x << endl

int main() {
	ios::sync_with_stdio(false);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int n; cin >> n;
	string s; cin >> s;
	int patches = 0;
	for (int i = 1; i < n; i++) {
		char curr = s[i];
		char prev = s[i - 1];
		char next = (i + 1 < n ? s[i + 1] : '_');

		if (curr == prev) {
			if (prev == 'R') {
				if (next == 'R')
					curr = 'B';
				if (next == 'B')
					curr = 'G';
				if (next == 'G')
					curr = 'B';
				if (next == '_')
					curr = 'G';
			}
			if (prev == 'B') {
				if (next == 'R')
					curr = 'G';
				if (next == 'B')
					curr = 'R';
				if (next == 'G')
					curr = 'R';
				if (next == '_')
					curr = 'G';
			}
			if (prev == 'G') {
				if (next == 'R')
					curr = 'B';
				if (next == 'B')
					curr = 'R';
				if (next == 'G')
					curr = 'B';
				if (next == '_')
					curr = 'A';
			}
			s[i] = curr;
			patches++;
		}
	}

	cout << patches << endl;
	cout << s;

#ifdef _DEBUG
	cout << "\nProgram finished.\n";
	while (true);
#endif
	return 0;
}


#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>

using namespace std;

char COLOR[] = "RGB";

int d[111111][3];

bool is_same_color(char ch, int color_idx) {
    return ((ch == 'R' && color_idx == 0) ||
            (ch == 'G' && color_idx == 1) ||
            (ch == 'B' && color_idx == 2));
}

int main(void) {
    memset(d, 0, sizeof(d));

    int n;
    string s;
    cin >> n >> s;

    for (int i = 1; i <= n; i++) {
        for (int curr_color = 0; curr_color < 3; curr_color++) {
            d[i][curr_color] = INT_MAX;
            for (int prev_color = 0; prev_color < 3; prev_color++) {
                if (curr_color == prev_color) continue;

                d[i][curr_color] = min(d[i][curr_color],
                                       d[i-1][prev_color] + !is_same_color(s[i-1], curr_color));
                //printf("%d %d = %d\n", i, curr_color, d[i][curr_color]);
            }
        }
    }

    int min_cnt = INT_MAX;
    min_cnt = min(min_cnt, d[n][0]);
    min_cnt = min(min_cnt, d[n][1]);
    min_cnt = min(min_cnt, d[n][2]);

    int min_idx;
    for (min_idx = 0; min_idx < 3; min_idx++) if (d[n][min_idx] == min_cnt) break;

    string res;
    int curr_color = min_idx;
    for (int i = n; i >= 1; i--) {
        res.push_back(COLOR[curr_color]);
        for (int prev_color = 0; prev_color < 3; prev_color++) {
            if (d[i-1][prev_color] + !is_same_color(s[i-1], curr_color) == d[i][curr_color]) {
                curr_color = prev_color;
                break;
            }
        }
    }
    reverse(res.begin(), res.end());
    cout << min_cnt << endl;
    cout << res << endl;

    return 0;
}


#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>

using namespace std;

char COLOR[] = "RGB";

int d[333333][3];

bool is_same_color(char ch, int color_idx) {
    return COLOR[color_idx] == ch;
}

int main(void) {
    d[0][0] = d[0][1] = d[0][2] = 0;
    int n;
    string s;
    cin >> n >> s;
    for (int i = 1; i <= n; i++) {
        for (int curr_color = 0; curr_color < 3; curr_color++) {
            d[i][curr_color] = INT_MAX;
            for (int prev_color = 0; prev_color < 3; prev_color++) {
                if (curr_color == prev_color) continue;

                d[i][curr_color] = min(d[i][curr_color],
                                       d[i-1][prev_color] + !is_same_color(s[i-1], curr_color));
            }
        }
    }

    int min_cnt = INT_MAX;
    min_cnt = min(min_cnt, d[n][0]);
    min_cnt = min(min_cnt, d[n][1]);
    min_cnt = min(min_cnt, d[n][2]);

    int min_idx;
    for (min_idx = 0; min_idx < 3; min_idx++) if (d[n][min_idx] == min_cnt) break;

    string res;
    int curr_color = min_idx;
    for (int i = n; i >= 1; i--) {
        res.push_back(COLOR[curr_color]);
        for (int prev_color = 0; prev_color < 3; prev_color++) {
            if (d[i-1][prev_color] + !is_same_color(s[i-1], curr_color) == d[i][curr_color]) {
                curr_color = prev_color;
                break;
            }
        }
    }
    reverse(res.begin(), res.end());
    cout << min_cnt << endl;
    cout << res << endl;

    return 0;
}


#include <iostream>
#include <string>

using namespace std;

char COLOR[] = "RGB";

int d[111111][3];

bool is_same_color(char ch, int color_idx) {
    return ((ch == 'R' && color_idx == 0) ||
            (ch == 'G' && color_idx == 1) ||
            (ch == 'B' && color_idx == 2));
}

int main(void) {
    memset(d, 0, sizeof(d));

    int n;
    string s;
    cin >> n >> s;

    for (int i = 1; i <= n; i++) {
        for (int curr_color = 0; curr_color < 3; curr_color++) {
            d[i][curr_color] = INT_MAX;
            for (int prev_color = 0; prev_color < 3; prev_color++) {
                if (curr_color == prev_color) continue;

                d[i][curr_color] = min(d[i][curr_color],
                                       d[i-1][prev_color] + !is_same_color(s[i-1], curr_color));
                //printf("%d %d = %d\n", i, curr_color, d[i][curr_color]);
            }
        }
    }

    int min_cnt = INT_MAX;
    min_cnt = min(min_cnt, d[n][0]);
    min_cnt = min(min_cnt, d[n][1]);
    min_cnt = min(min_cnt, d[n][2]);

    int min_idx;
    for (min_idx = 0; min_idx < 3; min_idx++) if (d[n][min_idx] == min_cnt) break;

    string res;
    int curr_color = min_idx;
    for (int i = n; i >= 1; i--) {
        res.push_back(COLOR[curr_color]);
        for (int prev_color = 0; prev_color < 3; prev_color++) {
            if (d[i-1][prev_color] + !is_same_color(s[i-1], curr_color) == d[i][curr_color]) {
                curr_color = prev_color;
                break;
            }
        }
    }
    reverse(res.begin(), res.end());
    cout << min_cnt << endl;
    cout << res << endl;

    return 0;
}


#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>

using namespace std;

char COLOR[] = "RGB";

int d[222222][3];

bool is_same_color(char ch, int color_idx) {
    return COLOR[color_idx] == ch;
}

int main(void) {
    memset(d, 0, sizeof(d));

    int n;
    string s;
    cin >> n >> s;

    for (int i = 1; i <= n; i++) {
        for (int curr_color = 0; curr_color < 3; curr_color++) {
            d[i][curr_color] = INT_MAX;
            for (int prev_color = 0; prev_color < 3; prev_color++) {
                if (curr_color == prev_color) continue;

                d[i][curr_color] = min(d[i][curr_color],
                                       d[i-1][prev_color] + !is_same_color(s[i-1], curr_color));
            }
        }
    }

    int min_cnt = INT_MAX;
    min_cnt = min(min_cnt, d[n][0]);
    min_cnt = min(min_cnt, d[n][1]);
    min_cnt = min(min_cnt, d[n][2]);

    int min_idx;
    for (min_idx = 0; min_idx < 3; min_idx++) if (d[n][min_idx] == min_cnt) break;

    string res;
    int curr_color = min_idx;
    for (int i = n; i >= 1; i--) {
        res.push_back(COLOR[curr_color]);
        for (int prev_color = 0; prev_color < 3; prev_color++) {
            if (d[i-1][prev_color] + !is_same_color(s[i-1], curr_color) == d[i][curr_color]) {
                curr_color = prev_color;
                break;
            }
        }
    }
    reverse(res.begin(), res.end());
    cout << min_cnt << endl;
    cout << res << endl;

    return 0;
}


#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>

using namespace std;

char COLOR[] = "RGB";

int d[333333][3];

bool is_same_color(char ch, int color_idx) {
    return COLOR[color_idx] == ch;
}

int main(void) {
    d[0][0] = d[0][1] = d[0][2] = 0;
    int n;
    string s;
    cin >> n >> s;
    for (int i = 1; i <= n; i++) {
        for (int curr_color = 0; curr_color < 3; curr_color++) {
            d[i][curr_color] = INT_MAX;
            for (int prev_color = 0; prev_color < 3; prev_color++) {
                if (curr_color == prev_color) continue;

                d[i][curr_color] = min(d[i][curr_color],
                                       d[i-1][prev_color] + !is_same_color(s[i-1], curr_color));
            }
        }
    }

    int min_cnt = INT_MAX;
    min_cnt = min(min_cnt, d[n][0]);
    min_cnt = min(min_cnt, d[n][1]);
    min_cnt = min(min_cnt, d[n][2]);

    int min_idx;
    for (min_idx = 0; min_idx < 3; min_idx++) if (d[n][min_idx] == min_cnt) break;

    string res;
    int curr_color = min_idx;
    for (int i = n; i >= 1; i--) {
        res.push_back(COLOR[curr_color]);
        for (int prev_color = 0; prev_color < 3; prev_color++) {
            if (curr_color == prev_color) continue;
            if (d[i-1][prev_color] + !is_same_color(s[i-1], curr_color) == d[i][curr_color]) {
                curr_color = prev_color;
                break;
            }
        }
    }
    reverse(res.begin(), res.end());
    cout << min_cnt << endl;
    cout << res << endl;

    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstring>
#define MAXN 200100
#define ll long long
using namespace std;
inline ll get_num() {
	char c;
	bool flag=1;
	ll num=0;
	while((c=getchar())==' '||c=='\r'||c=='\n');
	if(c=='-')flag=0;
	else num=c-'0';
	while(isdigit(c=getchar()))
	num=num*10+c-'0';
	return num*(flag?1:-1);
}
ll n,t[MAXN];
int main() {
	n=get_num();
	for(int i=1;i<=n;++i) {
		char c=getchar();
		if(c=='R')t[i]=1;
		if(c=='G')t[i]=2;
		if(c=='B')t[i]=3;
	}
	ll ans=0;
	for(int i=2;i<=n;) {
		if(t[i]==t[i-1]||t[i]==t[i+1]) {
			for(int j=1;j<=3;++j) {
				if(t[i-1]!=j&&t[i+1]!=j) {
					t[i]=j;
					ans++;
					break;
				}
			}
			if(t[i+1]==t[i+2])i+=2;
			else i+=3;
		}
		else {
			if(t[i+1]==t[i+2])i+=2;
			else i+=3;
		}
	}
	cout<<ans<<'\n';
	for(int i=1;i<=n;++i) {
		if(t[i]==1)putchar('R');
		if(t[i]==2)putchar('G');
		if(t[i]==3)putchar('B');
	}
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstring>
#define MAXN 200100
#define ll long long
using namespace std;
inline ll get_num() {
	char c;
	bool flag=1;
	ll num=0;
	while((c=getchar())==' '||c=='\r'||c=='\n');
	if(c=='-')flag=0;
	else num=c-'0';
	while(isdigit(c=getchar()))
	num=num*10+c-'0';
	return num*(flag?1:-1);
}
ll n,t[MAXN];
int main() {
	n=get_num();
	for(int i=1;i<=n;++i) {
		char c=getchar();
		if(c=='R')t[i]=1;
		if(c=='G')t[i]=2;
		if(c=='B')t[i]=3;
	}
	ll ans=0;
	for(int i=1;i<n;++i) {
		if(t[i]==t[i+1]) {
			for(int j=1;j<=3;++j) {
				if(j!=t[i]&&j!=t[i+2]) {
					t[i+1]=j;
					ans++;
					break;
				}
			}
		}
	}
	cout<<ans<<'\n';
	for(int i=1;i<=n;++i) {
		if(t[i]==1)putchar('R');
		if(t[i]==2)putchar('G');
		if(t[i]==3)putchar('B');
	}
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstring>
#define MAXN 200100
#define ll long long
using namespace std;
inline ll get_num() {
	char c;
	bool flag=1;
	ll num=0;
	while((c=getchar())==' '||c=='\r'||c=='\n');
	if(c=='-')flag=0;
	else num=c-'0';
	while(isdigit(c=getchar()))
	num=num*10+c-'0';
	return num*(flag?1:-1);
}
ll n,t[MAXN];
int main() {
	n=get_num();
	for(int i=1;i<=n;++i) {
		char c=getchar();
		if(c=='R')t[i]=1;
		if(c=='G')t[i]=2;
		if(c=='B')t[i]=3;
	}
	ll ans=0;
	for(int i=1;i<n;++i) {
		if(t[i]==t[i+1]) {
			for(int j=1;j<=3;++j) {
				if(j!=t[i]&&j!=t[i+1]) {
					t[i+1]=j;
					ans++;
					break;
				}
			}
		}
	}
	cout<<ans<<'\n';
	for(int i=1;i<=n;++i) {
		if(t[i]==1)putchar('R');
		if(t[i]==2)putchar('G');
		if(t[i]==3)putchar('B');
	}
}


#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<map>
#define ll long long
#define MAXN 100010
using namespace std;
inline ll get_num() {
	char c;
	bool flag=1;
	ll num=0;
	while((c=getchar())==' '||c=='\r'||c=='\n');
	if(c=='-')flag=0;
	else num=c-'0';
	while(isdigit(c=getchar()))
	num=num*10+c-'0';
	return num*(flag?1:-1);
}
ll n,R0,G0,B0,R1,G1,B1,R2,G2,B2,len;
char s[MAXN];
int main() {
	n=get_num();
	for(int i=0;i<n;++i)cin>>s[i];
	len=n;
	for(int i=0;i<len;++i) {
		if(s[i]=='R') {
			if(i%3==0)R0++;
			if(i%3==1)R1++;
			if(i%3==2)R2++;
		}
		if(s[i]=='G') {
			if(i%3==0)G0++;
			if(i%3==1)G1++;
			if(i%3==2)G2++;
		}
		if(s[i]=='B') {
			if(i%3==0)B0++;
			if(i%3==1)B1++;
			if(i%3==2)B2++;
		}
	}
	int RGB=(G0+B0)+(R1+B1)+(R2+G2);
	int RBG=(G0+B0)+(R1+G1)+(R2+B2);
	int GRB=(R0+B0)+(G1+B1)+(R2+G2);
	int GBR=(R0+B0)+(R1+G1)+(G2+B2);
	int BGR=(R0+G0)+(B1+R1)+(B2+G2);
	int BRG=(R0+G0)+(B1+G1)+(B2+R2);
	int ans=MAXN;
	ans=min(ans,RGB);ans=min(ans,RBG);ans=min(ans,GRB);
	ans=min(ans,GBR);ans=min(ans,BGR);ans=min(ans,BRG);
	cout<<ans<<'\n';
	if(ans==0) {
		cout<<s;
		return 0;
	}
	if(ans==RGB) {
		for(int i=0;i<len;++i) {
			if(i%3==0)cout<<"R";
			if(i%3==1)cout<<"G";
			if(i%3==2)cout<<"B";
		}
		return 0;
	}
	if(ans==RBG) {
		for(int i=0;i<len;++i) {
			if(i%3==0)cout<<"R";
			if(i%3==1)cout<<"B";
			if(i%3==2)cout<<"G";
		}
		return 0;
	}
	if(ans==BRG) {
		for(int i=0;i<len;++i) {
			if(i%3==0)cout<<"B";
			if(i%3==1)cout<<"R";
			if(i%3==2)cout<<"G";
		}
		return 0;
	}
	if(ans==BGR) {
		for(int i=0;i<len;++i) {
			if(i%3==0)cout<<"B";
			if(i%3==1)cout<<"G";
			if(i%3==2)cout<<"R";
		}
		return 0;
	}
	if(ans==GBR) {
		for(int i=0;i<len;++i) {
			if(i%3==0)cout<<"G";
			if(i%3==1)cout<<"B";
			if(i%3==2)cout<<"R";
		}
		return 0;
	}
	if(ans==GRB) {
		for(int i=0;i<len;++i) {
			if(i%3==0)cout<<"G";
			if(i%3==1)cout<<"R";
			if(i%3==2)cout<<"B";
		}
		return 0;
	}
}


import java.util.*;
import java.lang.Math;
public class Main
{
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();
	    int a[]=new int[n];
	    int p=0;
	    for(int i=0;i<n;i++){
	        a[i]=sc.nextInt();
	        if(a[i]>0) p++;
	    }
	    Arrays.sort(a);
	    if(p>0){
	        System.out.println(1+" "+a[0]);
	        System.out.println(1+" "+a[n-1]);
	        System.out.print(n-2+" ");
	        for(int i=1;i<n-1;i++) System.out.print(a[i]+" ");

	    }
	    else{
	        System.out.println(1+" "+a[0]);
	        System.out.println(2+" "+a[1]+" "+a[2]);
	        System.out.print(n-3+" ");
	        for(int i=3;i<n;i++) System.out.print(a[i]+" ");
	    }
	}
}


import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        ArrayList<Integer> neg = new ArrayList<>();
        ArrayList<Integer> pos = new ArrayList<>();
        int zeros = 0;
        for(int i=0;i<n;i++){
            int temp = s.nextInt();
            if(temp<0){
                neg.add(temp);
            }else if(temp>0){
                pos.add(temp);
            }else{
                zeros++;
            }
        }
        if(pos.size()!=0){
            if(neg.size()%2!=0){
                System.out.print(neg.size()+" ");
                for(int i=0;i<neg.size();i++){
                    System.out.print(neg.get(i)+" ");
                }
                System.out.println();
            }else{
                System.out.print((neg.size()-1)+" ");
                for(int i=0;i<neg.size()-1;i++){
                    System.out.print(neg.get(i)+" ");
                }
                System.out.println();
            }
        }else{
            if(neg.size()%2!=0){
                System.out.print((neg.size()-2)+" ");
                for(int i=0;i<neg.size()-2;i++){
                    System.out.print(neg.get(i)+" ");
                }
                System.out.println();
            }else{
                System.out.print((neg.size()-3)+" ");
                for(int i=0;i<neg.size()-3;i++){
                    System.out.print(neg.get(i)+" ");
                }
                System.out.println();
            }
        }

        if(pos.size()!=0){
            System.out.print(pos.size()+" ");
            for(int i=0;i<pos.size();i++){
                System.out.print(pos.get(i)+" ");
            }
            System.out.println();
        }else{
            System.out.print("2 ");
            for(int i=0;i<2;i++){
                System.out.print(neg.get(i)+" ");
            }
            System.out.println();
        }

        if(neg.size()%2==0){
            System.out.print((zeros+1)+" ");
            for(int i=0;i<zeros;i++){
                System.out.print("0 ");
            }
            System.out.println(neg.get(neg.size()-1));
        }else{
            System.out.print((zeros)+" ");
            for(int i=0;i<zeros;i++){
                System.out.print("0 ");
            }
            System.out.println();
        }

    }
}


import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        ArrayList<Integer> neg = new ArrayList<>();
        ArrayList<Integer> pos = new ArrayList<>();
        int zeros = 0;
        for(int i=0;i<n;i++){
            int temp = s.nextInt();
            if(temp<0){
                neg.add(temp);
            }else if(temp>0){
                pos.add(temp);
            }else{
                zeros++;
            }
        }
        if(pos.size()!=0){
            if(neg.size()%2!=0){
                System.out.print(neg.size()+" ");
                for(int i=0;i<neg.size();i++){
                    System.out.print(neg.get(i)+" ");
                }
                System.out.println();
            }else{
                System.out.print((neg.size()-1)+" ");
                for(int i=0;i<neg.size()-1;i++){
                    System.out.print(neg.get(i)+" ");
                }
                System.out.println();
            }
        }else{
            if(neg.size()%2!=0){
                System.out.print((neg.size()-2)+" ");
                for(int i=2;i<neg.size();i++){
                    System.out.print(neg.get(i)+" ");
                }
                System.out.println();
            }else{
                System.out.print((neg.size()-3)+" ");
                for(int i=2;i<neg.size()-1;i++){
                    System.out.print(neg.get(i)+" ");
                }
                System.out.println();
            }
        }

        if(pos.size()!=0){
            System.out.print(pos.size()+" ");
            for(int i=0;i<pos.size();i++){
                System.out.print(pos.get(i)+" ");
            }
            System.out.println();
        }else{
            System.out.print("2 ");
            for(int i=0;i<2;i++){
                System.out.print(neg.get(i)+" ");
            }
            System.out.println();
        }

        if(neg.size()%2==0){
            System.out.print((zeros+1)+" ");
            for(int i=0;i<zeros;i++){
                System.out.print("0 ");
            }
            System.out.println(neg.get(neg.size()-1));
        }else{
            System.out.print((zeros)+" ");
            for(int i=0;i<zeros;i++){
                System.out.print("0 ");
            }
            System.out.println();
        }

    }
}


import java.util.*;
public class MyClass {
    public static void main(String args[]) {
        Scanner sc=new Scanner(System.in);
        int s=sc.nextInt();
        Vector<Integer> p=new Vector<>(),n=new Vector<>(),z=new Vector<>();
        for(int i=0;i<s;i++){
            int a=sc.nextInt();
            if(a>0)p.add(a);
            else if(a<0)n.add(a);
            else z.add(a);
        }
        int idx=0;
        if(n.size()%2==0)z.add(n.get(idx++));
        if(p.size()==0){
            p.add(n.get(idx++));
            p.add(n.get(idx++));
        }
        System.out.print((n.size()-idx)+" ");
        for(int i=idx;i<n.size();i++)System.out.print(n.get(i)+" ");
        System.out.print("\n"+p.size()+" ");
        for(Integer i:p)System.out.print(i+" ");
        System.out.print("\n"+z.size()+" ");
        for(Integer i:z)System.out.print(i+" ");

    }
}


// Rating 1400+
import java.util.*;
public class Main {
    public void function(int[] arr, int n, int p, int z) {
        Arrays.sort(arr);
        boolean posFlag = false;
        if (p == 0) { n -= 2; p += 2; posFlag = true;}

        int[] narr = new int[n];
        int[] parr = new int[p];
        int[] isZero = new int[z];
        int pointer = 0;

        for (int i = 0; i < n; i++, pointer++)
            narr[i] = arr[pointer];
        if (posFlag)
            for (int i = 0; i < p; i++, pointer++)
                parr[i] = arr[pointer];
        for (int i = 0; i < z; i++, pointer++) isZero[i] = 0;
        if (!posFlag)
            for (int i = 0; i < p; i++, pointer++)
                    parr[i] = arr[pointer];

        // negative
        System.out.print(narr.length + " ");
        for (int i = 0; i < narr.length; i++) System.out.print(narr[i] + " ");
        System.out.println();
        //positive
        System.out.print(parr.length + " ");
        for (int i = 0; i < parr.length; i++) System.out.print(parr[i] + " ");
        System.out.println();
        //zero
        System.out.print(isZero.length + " ");
        for (int i = 0; i < isZero.length; i++) System.out.print(isZero[i] + " ");
        System.out.println();
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Main o = new Main();

        int n = in.nextInt(), neg = 0, pos = 0, zer = 0;
        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
            if (arr[i] == 0) zer++;
            else if (arr[i] < 0) neg++;
            else pos++;
        }

        o.function(arr, neg, pos, zer);
    }
}


// Rating 1400+
import java.util.*;
public class Main {
    public void function(int[] arr, int n, int p, int z) {
        Arrays.sort(arr);
        boolean posFlag = false;
        if (p == 0) { n -= 2; p += 2; posFlag = true; }

        boolean negFlag = false;
        if (n%2 == 0) { n -= 1; negFlag = true; z++; }

        int[] narr = new int[n];
        int[] parr = new int[p];
        int[] isZero = new int[z];
        int pointer = 0;
        int zp = 0;

        for (int i = 0; i < n; i++, pointer++)
            narr[i] = arr[pointer];
        if (posFlag)
            for (int i = 0; i < p; i++, pointer++)
                parr[i] = arr[pointer];
        if (negFlag) {
            zp++;
            isZero[0] = arr[pointer];
            pointer++;
        }
        for (int i = zp; i < z; i++, pointer++) isZero[i] = 0;
        if (!posFlag)
            for (int i = 0; i < p; i++, pointer++)
                    parr[i] = arr[pointer];

        // negative
        System.out.print(narr.length + " ");
        for (int i = 0; i < narr.length; i++) System.out.print(narr[i] + " ");
        System.out.println();
        //positive
        System.out.print(parr.length + " ");
        for (int i = 0; i < parr.length; i++) System.out.print(parr[i] + " ");
        System.out.println();
        //zero
        System.out.print(isZero.length + " ");
        for (int i = 0; i < isZero.length; i++) System.out.print(isZero[i] + " ");
        System.out.println();
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Main o = new Main();

        int n = in.nextInt(), neg = 0, pos = 0, zer = 0;
        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
            if (arr[i] == 0) zer++;
            else if (arr[i] < 0) neg++;
            else pos++;
        }

        o.function(arr, neg, pos, zer);
    }
}


import java.util.*;
import java.io.*;

public class A2OJ
{
	public static class FastIO
	{
		BufferedReader br;
		BufferedWriter bw;
		StringTokenizer st;

		public FastIO()
		{
			br = new BufferedReader(new InputStreamReader(System.in));
			bw = new BufferedWriter(new OutputStreamWriter(System.out));
			st = new StringTokenizer("");
		}

		public FastIO(int x) throws IOException
		{
			br = new BufferedReader(new FileReader("input.txt"));
			bw = new BufferedWriter(new FileWriter("output.txt"));
			st = new StringTokenizer("");
		}

		private void read() throws IOException
		{
			st = new StringTokenizer(br.readLine());
		}

		public String ns() throws IOException
		{
			if(!st.hasMoreTokens())
				read();
			return st.nextToken();
		}

		public int ni() throws IOException
		{
			return Integer.parseInt(ns());
		}

		public long nl() throws IOException
		{
			return Long.parseLong(ns());
		}

		public float nf() throws IOException
		{
			return Float.parseFloat(ns());
		}

		public double nd() throws IOException
		{
			return Double.parseDouble(ns());
		}

		public char nc() throws IOException
		{
			return ns().charAt(0);
		}

		public void out(String s) throws IOException
		{
			bw.write(s);
		}

		public void flush() throws IOException
		{
			bw.flush();
		}
	}

	public static void main(String args[]) throws IOException
	{
		FastIO f = new FastIO();

		int n = f.ni(), a[] = new int[n], ni1 = -1, ni2 = -1, ni3 = -1, pi = -1, ln = n-2, i;

		for(i = 0; i < n; i++)
		{
			a[i] = f.ni();
			if(a[i] < 0)
			{
				if(ni1 == -1)
					ni1 = i;
				else if(ni2 == -1)
					ni2 = i;
				else if(ni3 == -1)
					ni3 = i;
			}
			else if(a[i] > 0 && pi == -1)
				pi = i;
		}

		f.out("1 " + a[ni1] + "\n");
		if(ni2 != -1 && ni3 != -1)
		{
			f.out("2 " + a[ni2] + " " + a[ni3] + "\n");
			pi = -1;
			ln--;
		}
		else
		{
			f.out("1 " + a[pi] + "\n");
			ni2 = ni3 = -1;
		}

		f.out(ln + " ");
		for(i = 0; i < n; i++)
		{
			if(i == ni1 || i == ni2 || i == ni3 || i == pi)
				continue;
			f.out(a[i] + " ");
		}
		f.out("\n");

		f.flush();
	}
}


import java.io.*;
import java.util.*;
public class main {

    static StringBuilder out=new StringBuilder();
    static FastReader in=new FastReader();

    public static void main(String args[]){
        int n=in.nextInt();
        int arr[]=getIntArray(n);
        int pos=0, neg=0, zer=0;
        for(int a:arr){
            if(a==0)zer++;
            if(a<0)neg++;
            if(a>0)pos++;
        }
        boolean []v=new boolean[n];
        out.append(1+" ");
        for(int i=0;i<n;i++){
            if(arr[i]<0){
                out.append(arr[i]+"\n");
                v[i]=true;
                break;
            }
        }
        neg--;
        neg=(neg/2)*2;
        // System.out.println(neg);
        out.append((neg+pos)+" ");
        zer=pos+neg+1;
        for(int i=0;i<n;i++){
            if(arr[i]>0 && pos-->0){
                out.append(arr[i]+" ");
                v[i]=true;
            }
            if(arr[i]<0 && !v[i] && neg-->0){
                v[i]=true;
                out.append(arr[i]+" ");
            }
        }
        // zer=0;
        // for(int i=0;i<n;i++){
        //     zer+=(v[i])?0:1;
        // }
        out.append('\n').append(n-zer).append(" ");
        for(int i=0;i<n;i++){
            if(!v[i]){
                out.append(arr[i]+" ");
            }
        }
        System.out.println(out);

    }

    public static int[] getIntArray(int n){
        int arr[]=new int[n];
        for(int i=0;i<n;i++){
            arr[i]=in.nextInt();
        }
        return arr;
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.io.*;
import java.util.*;
public class main {

    static StringBuilder out=new StringBuilder();
    static FastReader in=new FastReader();

    public static void main(String args[]){
        int n=in.nextInt();
        int arr[]=getIntArray(n);
        int pos=0, neg=0, zer=0;
        for(int a:arr){
            if(a==0)zer++;
            if(a<0)neg++;
            if(a>0)pos++;
        }
        boolean []v=new boolean[n];
        out.append(1+" ");
        for(int i=0;i<n;i++){
            if(arr[i]<0){
                out.append(arr[i]+"\n");
                v[i]=true;
                break;
            }
        }
        neg--;
        neg=(neg/2)*2;
        // System.out.println(neg);
        out.append((neg+pos)+" ");
        pos=pos+neg+1;
        for(int i=0;i<n;i++){
            if(arr[i]>0 && pos-->0){
                out.append(arr[i]+" ");
                v[i]=true;
            }
            if(arr[i]<0 && !v[i] && neg-->0){
                v[i]=true;
                out.append(arr[i]+" ");
            }
        }
        // zer=0;
        // for(int i=0;i<n;i++){
        //     zer+=(v[i])?0:1;
        // }
        out.append('\n').append(n-pos).append(" ");
        for(int i=0;i<n;i++){
            if(!v[i]){
                out.append(arr[i]+" ");
            }
        }
        System.out.println(out);

    }

    public static int[] getIntArray(int n){
        int arr[]=new int[n];
        for(int i=0;i<n;i++){
            arr[i]=in.nextInt();
        }
        return arr;
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
 {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = in.nextInt() , neg[]=new int[n] , pos[]= new int [n] , zero[]=new int [n] ,indn=0,indp=0,indz=0 ,x ;
        for(int i=0;i<n;i++)
        {
          x=in.nextInt();
          if(x>0)
          {
          pos[indp]=x;
          indp++;
          }
          else if (x<0)
          {
              neg[indn]=x;
              indn++;
          }
          else
          {
              zero[indz]=x;
              indz++;
          }

         }

        if(indp == 0)
        {
            indn--;
            pos[indp++] = neg[indn--];
            pos[indp++] = neg[indn];
        }
         if(indn%2==0)
        {
             indn--;
             zero[indz++] = neg[indn];
        }

        System.out.print(indn+" ");
        for(int i=0 ; i <indn ;i++)
        {
             System.out.print(neg[i]);

            if(i<indn-1)
                System.out.print(" ");
        }
        System.out.println();

        System.out.print(indp+" ");
        for(int i=0 ; i <indp ;i++)
        {
            System.out.print(pos[i]);
            if(i<indp-1)
                System.out.print(" ");
        }
         System.out.println();

         System.out.print(indz+" ");
         for(int i=0 ; i <indz ;i++)
        {
            System.out.print(zero[i]);
            if(i<indz-1)
                System.out.print(" ");
        }

    }
   }


import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
 {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = in.nextInt() , neg[]=new int[n] , pos[]= new int [n] , zero[]=new int [n] ,indn=0,indp=0,indz=0 ,x ;
        for(int i=0;i<n;i++)
        {
          x=in.nextInt();
          if(x>0)
          {
          pos[indp]=x;
          indp++;
          }
          else if (x<0)
          {
              neg[indn]=x;
              indn++;
          }
          else
          {
              zero[indz]=x;
              indz++;
          }

         }

        if(indp == 0)
        {
            indn--;
            pos[indp++] = neg[indn--];
            pos[indp++] = neg[indn];
        }
        else if(indn%2==0)
        {
             indn--;
             zero[indz++] = neg[indn];
        }

        System.out.print(indn+" ");
        for(int i=0 ; i <indn ;i++)
        {
             System.out.print(neg[i]);

            if(i<indn-1)
                System.out.print(" ");
        }
        System.out.println();

        System.out.print(indp+" ");
        for(int i=0 ; i <indp ;i++)
        {
            System.out.print(pos[i]);
            if(i<indp-1)
                System.out.print(" ");
        }
         System.out.println();

         System.out.print(indz+" ");
         for(int i=0 ; i <indz ;i++)
        {
            System.out.print(zero[i]);
            if(i<indz-1)
                System.out.print(" ");
        }

    }
   }


package solve;

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
 {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = in.nextInt() , neg[]=new int[n] , pos[]= new int [n] , zero[]=new int [n] ,indn=0,indp=0,indz=0 ,x ;
        for(int i=0;i<n;i++)
        {
          x=in.nextInt();
          if(x>0)
          {
          pos[indp]=x;
          indp++;
          }
          else if (x<0)
          {
              neg[indn]=x;
              indn++;
          }
          else
          {
              zero[indz]=x;
              indz++;
          }

         }

        if(indp == 0)
        {
            indn--;
            pos[indp++] = neg[indn--];
            pos[indp++] = neg[indn];
        }
        else if(indn%2==0)
        {
             indn--;
             zero[indz++] = neg[indn];
        }

        System.out.print(indn+" ");
        for(int i=0 ; i <indn ;i++)
        {
             System.out.print(neg[i]);

            if(i<indn-1)
                System.out.print(" ");
        }
        System.out.println();

        System.out.print(indp+" ");
        for(int i=0 ; i <indp ;i++)
        {
            System.out.print(pos[i]);
            if(i<indp-1)
                System.out.print(" ");
        }
         System.out.println();

         System.out.print(indz+" ");
         for(int i=0 ; i <indz ;i++)
        {
            System.out.print(zero[i]);
            if(i<indz-1)
                System.out.print(" ");
        }

    }
   }