#include <bits/stdc++.h>
using namespace std;
const int maxn = 500;
char a[maxn];
int b[500];
int main() {
  int n;
  while (cin >> n) {
    cin >> a;
    int len = strlen(a);
    int cou = 0, flag = 0, cnt = 0;
    for (int i = 0; i < len; i++) {
      if (a[i] == 'B' && flag == 0) {
        flag = 1;
        cou++;
        cnt++;
        b[cou] = cnt;
        continue;
      }
      if (flag == 1) {
        if (a[i] == 'B') {
          cnt++;
          b[cou] = cnt;
          continue;
        } else {
          cnt = 0;
          flag = 0;
          continue;
        }
      }
    }
    cout << cou << endl;
    if (cou == 0) continue;
    for (int i = 1; i <= cou - 1; i++) cout << b[i] << " ";
    cout << b[cou] << endl;
  }
  return 0;
}
