#include <bits/stdc++.h>
int main() {
  int n, x = 0, z[100], m = 0;
  char a[101];
  scanf("%d", &n);
  scanf("%s", &a);
  for (int i = 0; i < n; i++) {
    if ((a[i] == 'B')) {
      x++;
      int y = 0;
      for (i; a[i] == 'B'; i++) {
        y++;
      }
      z[m] = y;
      m++;
    }
  }
  printf("%d\n", x);
  if (x != 0) {
    for (int i = 0; i < m; i++) {
      printf("%d ", z[i]);
    }
  }
  return 0;
}
