#include <bits/stdc++.h>
int main() {
  unsigned short length;
  char line[101];
  unsigned short count[101];
  unsigned short i, j;
  unsigned short blacks = 0;
  char current;
  scanf("%hu", &length);
  scanf("%c", &current);
  for (i = 0; i < length; i++) {
    scanf("%c", &current);
    if (current == 'B') {
      count[++blacks] = 0;
      while ((current == 'B') && (i < length)) {
        count[blacks]++;
        scanf("%c", &current);
        i++;
      }
    }
  }
  if (blacks) {
    printf(
        "%hu"
        "\n",
        blacks);
    for (i = 1; i <= blacks; i++) {
      printf(
          "%hu"
          " ",
          count[i]);
    }
    printf("\n");
  } else {
    printf("0\n");
  }
  return 0;
}
