#include <bits/stdc++.h>
int main() {
  int N;
  scanf("%d\n", &N);
  char arr[110];
  fgets(arr, N + 1, stdin);
  int cnt = 0;
  bool sw = 0;
  int out[100] = {0};
  int k = 0;
  for (int i = 0; i < N; i++) {
    if (arr[i] == 'B') {
      cnt++;
      sw = 1;
    } else if (cnt > 0) {
      out[k] = cnt;
      k++;
      cnt = 0;
    }
  }
  if (cnt != 0) {
    out[k] = cnt;
    k++;
  }
  if (sw == 0) {
    printf("0 ");
  } else {
    printf("%d\n", k);
    for (int i = 0; i < k; i++) {
      printf("%d ", out[i]);
    }
  }
  return 0;
}
