#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (~scanf("%d", &n)) {
    char s[105];
    memset(s, '\0', sizeof(s));
    scanf("%s", s);
    int i, ans[105], block = 0, ifw = 0, sum = 0;
    memset(ans, 0, sizeof(ans));
    for (i = 0; i < n; i++)
      if (s[i] == 'B') sum++;
    if (sum != 0) block = 1;
    for (i = 0; i < n; i++) {
      if (s[i] == 'B') {
        if (ifw == 1) {
          if (ans[block] != 0) block++;
          ifw = 0;
        }
        if (ifw == 0) ans[block]++;
      }
      if (s[i] == 'W') {
        ifw = 1;
      }
    }
    printf("%d\n", block);
    for (i = 1; i <= block; i++) {
      if (i < block)
        printf("%d ", ans[i]);
      else if (i == block)
        printf("%d\n", ans[i]);
    }
  }
  return 0;
}
