#include <bits/stdc++.h>
using namespace std;
int t;
int main() {
  int n = 0;
  cin >> t;
  t = 0;
  string s;
  cin >> s;
  vector<int> ans;
  if (s.size() == 1 && s[0] == 'B') return cout << 1 << ' ' << 1 << endl, 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'B' && (i == 0 || s[i - 1] == 'W')) n++, t = 0;
    if (s[i] == 'B') t++;
    if ((i == s.size() - 1 || s[i] == 'W') && i != 0 &&
        (s[i - 1] == 'B' || (i == s.size() - 1 && s[i] == 'B')))
      ans.push_back(t);
  }
  cout << n;
  for (int x : ans) cout << ' ' << x;
}
