#include <bits/stdc++.h>
using namespace std;
int n;
int ans[105];
char s[105];
int main() {
  scanf("%d", &n);
  cin >> s;
  int len = strlen(s);
  int t = 1, i;
  bool biao = true;
  for (i = 0; i < len; ++i)
    if (s[i] != 'W') {
      biao = false;
      break;
    }
  if (biao) {
    printf("0");
    return 0;
  }
  biao = true;
  for (i = 0; i < len; ++i)
    if (s[i] != 'B') {
      biao = false;
      break;
    }
  if (biao) {
    printf("1\n%d", n);
    return 0;
  }
  i = 0;
  if (s[0] == 'W') t--;
  while (i < len) {
    if (s[i] == 'B')
      ans[t]++, i++;
    else {
      while (s[i] == 'W') i++;
      t++;
    }
  }
  if (s[len - 1] == 'W') t--;
  printf("%d\n", t);
  for (int j = 1; j <= t; ++j) printf("%d ", ans[j]);
  return 0;
}
