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