#include <bits/stdc++.h>
const int NMAX = 150;
char ch[NMAX];
int v[NMAX];
int main() {
  int n, s = 0;
  scanf("%d\n%s", &n, ch);
  if (ch[0] == 'B') s = 1, v[1] = 1;
  for (int i = 1; i < n; ++i)
    if (ch[i] == 'B') {
      if (ch[i - 1] == 'B')
        ++v[s];
      else
        ++s, v[s] = 1;
    }
  printf("%d\n", s);
  for (int i = 1; i <= s; ++i) printf("%d ", v[i]);
  printf("\n");
  return 0;
}
