#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <math.h>
#include <string>
using namespace std;
bool temp[105];
int t[105];
int main() {
int n;
string s;
int ans = 0;
int k = 0;
cin >> n >> s;
for (int i = 0;i < 100;++i) {
for (int j = 0;j < n;++j) {
if (s[j] == 'B'&&temp[j]==false) {
int cnt = 1;
temp[j] = true;
for (int k = j + 1;k < n;++k) {
if (s[k] == 'B') {
cnt++;
temp[k] = true;
}
else {
break;
}
}
t[ans] = cnt;
ans++;
}
}
}
printf("%d\n", ans);
for (int i = 0;i < ans;++i) {
printf("%d ", t[i]);
}
//system("pause");
return 0;
}