#include <bits/stdc++.h>
using namespace std;
const int MaxN = 105;
char str[MaxN];
int N, Cnt, Ans[MaxN], Q[MaxN], CCnt;
int main() {
  scanf("%d", &N);
  scanf("%s", str + 1);
  Cnt = 1;
  for (int i = 1; i <= N; ++i)
    if (str[i] == 'W')
      ++Cnt;
    else
      ++Ans[Cnt];
  for (int i = 1; i <= Cnt; ++i)
    if (Ans[i]) Q[++CCnt] = Ans[i];
  printf("%d\n", CCnt);
  for (int i = 1; i <= CCnt; ++i) printf("%d ", Q[i]);
  return 0;
}
