#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n;
  char prev = 'a';
  int dur = 0;
  vector<int> durs;
  for (int i = 0; i < n; ++i) {
    char c;
    cin >> c;
    if (c == 'W') {
      if (dur != 0) durs.push_back(dur);
      dur = 0;
    } else {
      ++dur;
    }
  }
  if (dur != 0) durs.push_back(dur);
  cout << durs.size() << '\n';
  for (int i = 0; i < durs.size(); ++i) {
    cout << durs[i] << ' ';
  }
  return 0;
}
