#include <bits/stdc++.h>
using namespace std;
int power(int a, int b) {
  int res = 1;
  while (b) {
    if (b % 2) {
      res = (res * a) % 1000000007;
    }
    b /= 2;
    a = (a * a) % 1000000007;
  }
  return res;
}
int main(void) {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ct = 0;
  vector<int> v;
  int ct1 = 0;
  int flag = 0;
  for (int i = 0; i < (int)(n); ++i) {
    if (s[i] == 'W') {
      if (ct1) v.push_back(ct1);
      ct1 = 0;
      flag = 0;
    } else {
      if (flag == 0) {
        flag = 1;
        ct1++;
        ct++;
      } else
        ct1++;
    }
  }
  if (ct1) v.push_back(ct1);
  cout << ct << '\n';
  for (typeof(v.begin()) it = v.begin(); it != v.end(); it++) {
    cout << *it << ' ';
  }
  return 0;
}
