#include <bits/stdc++.h>
using namespace std;
long long ans[110], n, Count;
string s;
void process() {
  cin >> n;
  cin >> s;
  long long i = 0;
  while (i < n) {
    while (s[i] == 'W') ++i;
    long long j = i;
    if (s[i] == 'B') {
      while (s[i] == 'B') ++i;
      ans[++Count] = i - j;
    }
  }
  cout << Count << endl;
  for (int i = 1; i <= Count; ++i) cout << ans[i] << " ";
}
int main() {
  ios::sync_with_stdio(0);
  cout.tie(0);
  process();
}
