#include <bits/stdc++.h>
using namespace std;
int arr[101];
int main() {
  int n, ans = 0;
  char str[102];
  scanf("%d", &n);
  scanf("\n%s", str);
  int k = 0;
  if (str[0] == 'B') arr[0]++, ans = 1;
  for (int i = 1; i < n; i++) {
    if (str[i] == 'B')
      arr[k]++;
    else if (str[i - 1] == 'B' && str[i] == 'W')
      k++;
    if (str[i - 1] == 'W' && str[i] == 'B') ans++;
  }
  printf("%d\n", ans);
  if (ans)
    for (int i = 0; i < ans; i++) printf("%d ", arr[i]);
  return 0;
}
