#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v;
  int n, i, len, sum;
  char str[105];
  cin >> n;
  cin >> str;
  len = strlen(str);
  sum = 0;
  for (i = 0; i < len;) {
    if (str[i] == 'B') {
      sum++;
      i++;
      while (str[i] != 'W' && i < len) {
        sum++;
        i++;
      }
      v.push_back(sum);
      sum = 0;
    } else {
      i++;
    }
  }
  cout << v.size() << endl;
  for (i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << endl;
  return 0;
}
