#include <cstdio>
#define N 400010
#define mo 3
#define ll long long
#define fo(x, a, b) for (int x = (a); x <= (b); x++)
#define fd(x, a, b) for (int x = (a); x >= (b); x--)
using namespace std;
int n, a[N]; char s[N];
ll ans = 0;

ll ksm(ll x, int y) {
	ll s = 1;
	while (y) {
		if (y & 1) s = s * x % mo;
		x = x * x % mo, y >>= 1;
	}
	return s;
}

ll C(int x, int y) {
	if (x > y) return 0;
	ll res = 1;
	fo(i, x + 1, y) res = res * i;
	fo(i, 1, y - x) res = res * ksm(i, mo - 2);
	return res % mo;
}

ll Lucas(int x, int y) {
	if (x < mo && y < mo) return C(x, y);
	else return Lucas(x / mo, y / mo) * C(x % mo, y % mo) % mo;
}

int main() {
	scanf("%d%s", &n, s + 1);
	fo(i, 1, n)
		if (s[i] == 'R') a[i] = 0;
		else if (s[i] == 'W') a[i] = 1;
		else a[i] = 2;
	fo(i, 1, n)
		ans = (ans + Lucas(i - 1, n - 1) * a[i]) % 3;
	if (n % 2 == 0) ans = -ans;
	ans = (ans % 3 + 3) % 3;
	if (ans == 0) printf("R\n");
	else if (ans == 1) printf("W\n");
	else printf("B\n");
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

void debug_out(){
    cerr << endl;
}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef local
#define debug(...) cerr<<"["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
#else
#define debug(...) 55
#endif

const int N = 10005;
char s[N];
int a[N], b[N], c[N], n;
int ok(int k){
	for(int i = 1; i <= n; i++) b[i] = a[i] / k, c[i] = a[i] % k;
	for(int i = 1; i < n; i++){
		int x = b[i], y = b[i + 1];
		if(x == y) return 0;
		if(x == y - 1 && c[i] > c[i + 1]) return 0;
		if(x == y + 1 && c[i] < c[i + 1]) return 0;
	}
	return 1;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int ans = 0;
	cin >> n;
	n++;
	cin >> s + 1;
	int mn = 1e9;
	for(int i = 1; i <= n; i++) cin >> a[i], mn = min(mn, a[i]);
	for(int i = 1; i <= 10000; i++){
		if(ok(i)) ans = max(ans, i);
	}
	cout << ans << '\n';
	for(int i = 1; i <= ans; i++){
		for(int j = 1; j <= n; j++){
			int x = a[j] / ans, y = a[j] % ans;
			if(i <= y) x++;
			cout << x << ' ';
		}
		cout << '\n';
	}
	return 0;
}
