#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0;
  int k[100];
  int k_len = 0;
  cin >> n;
  string str;
  cin >> str;
  int len = str.size();
  int m = 0;
  for (int i = 0; i < len; ++i) {
    if (str[i] == 'b' || str[i] == 'B') {
      m++;
      int j = i + 1;
      for (; j < len; ++j) {
        if (str[j] == 'w' || str[j] == 'W') {
          k[k_len] = j - i;
          k_len++;
          i = j;
          break;
        }
      }
      if (j == len) {
        k[k_len] = len - i;
        k_len++;
        break;
      }
    }
  }
  cout << m << "\n";
  if (k_len == 0) return 0;
  for (int i = 0; i < k_len - 1; ++i) cout << k[i] << " ";
  cout << k[k_len - 1] << "\n";
  return 0;
}
