#include <bits/stdc++.h>
int n, k, t, a[100];
int main() {
  scanf("%d", &n);
  getchar();
  while (n > 0) {
    while ((n--) > 0 && getchar() == 'W')
      ;
    t = 1;
    while ((n--) > 0 && getchar() == 'B') t++;
    if (n > -2) a[k++] = t;
  };
  printf("%d\n", k);
  for (int i = 0; i < k; i++) printf("%d ", a[i]);
  return 0;
}
