#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, count = 0;
  static int ara[101];
  cin >> n;
  string str;
  cin >> str;
  for (int i = 0, j; i < n; i++) {
    if (str[i] == 'B') {
      for (j = 0; i + j < n; j++) {
        if (str[i + j] == 'W') break;
        ara[count]++;
      }
      count++;
      i = i + j;
    }
  }
  cout << count << endl;
  for (int i = 0; i < count; i++) {
    cout << ara[i] << " ";
  }
  if (count != 0) cout << endl;
}
