#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, s = 0, b[1000], j, r = 0;
  char a[110];
  cin >> n >> a;
  for (i = 0; i <= n; i++)
    if ((int)(a[i]) == 66) {
      r++;
      while ((int)(a[i]) == 66) {
        i++;
      }
    }
  for (j = 1; j <= r; j++) {
    b[j] = 0;
  }
  j = 1;
  for (i = 0; i <= n; i++)
    if ((int)(a[i]) == 66) {
      while ((int)(a[i]) == 66) {
        i++;
        b[j]++;
      }
      j++;
    }
  cout << r << endl;
  for (j = 1; j <= r; j++) {
    cout << b[j] << " ";
  }
  return 0;
}
