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