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