#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  string a;
  cin >> a;
  long long b[10000];
  long long k = 0;
  long long pos = -1;
  bool check = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == 'W') {
      if (i > pos + 1) {
        b[k] = i - pos - 1;
        k++;
      }
      pos = i;
    } else {
      check = 1;
    }
  }
  if (check == 0) {
    cout << 0;
    return 0;
  }
  if (pos < n - 1) {
    b[k] = n - pos - 1;
    k++;
  }
  cout << k << endl;
  for (long long i = 0; i < k; i++) {
    cout << b[i] << " ";
  }
}
