#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long int n;
  string s;
  cin >> n;
  cin >> s;
  vector<int> vi;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'W') continue;
    int j = i;
    while (j + 1 < n && s[j + 1] == 'B') j++;
    vi.push_back(j - i + 1);
    i = j;
  }
  cout << vi.size() << endl;
  for (auto v : vi) cout << v << " ";
  cout << endl;
}
