#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  s += "W";
  int g = 0, c = 0;
  vector<int> v;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'W') {
      if (i - c > 0) {
        v.push_back(i - c);
        c = i;
      }
      c = i + 1;
    }
  }
  cout << v.size() << "\n";
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  return 0;
}
