#include <bits/stdc++.h>
using namespace std;
int n, sum, ans, i, j, a[200];
char str[200];
int main() {
  cin >> n;
  memset(a, 0, sizeof(a));
  ans = j = 0;
  scanf("%s", str);
  for (i = 0; i < n; i++) {
    if (str[i] == 'B') {
      sum++;
      if (str[i + 1] == 'W' || str[i + 1] == '\0') {
        ans++;
        a[j++] = sum;
        sum = 0;
      }
    }
  }
  cout << ans << endl;
  if (!ans) return 0;
  cout << a[0];
  for (i = 1; i < j; i++) {
    cout << ' ' << a[i];
  }
  cout << endl;
  return 0;
}
