#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k = 0, a[51] = {};
  cin >> n;
  char c;
  for (int i = 0; i < n; i++) {
    cin >> c;
    if (c == 'B') a[k]++;
    if (c == 'W')
      if (a[k] != 0) k++;
  }
  if (a[k] != 0) k++;
  cout << k << endl;
  bool first = true;
  for (int i = 0; i < k; i++) {
    if (first == false)
      cout << " ";
    else
      first = false;
    cout << a[i];
  }
  return 0;
}
