#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> vec;
  int i = 0;
  while (i < n) {
    if (s[i] == 'W')
      i++;
    else {
      int c = 0;
      while (i < n && s[i] == 'B') c++, i++;
      vec.push_back(c);
    }
  }
  cout << vec.size() << endl;
  for (int i = 0; i < vec.size(); i++) cout << vec[i] << " ";
  cout << endl;
  return 0;
}
