#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  vector<int> a;
  if (s[0] == '.') a.push_back(0);
  int cnt = 1;
  for (int i = 1; i < n; i++) {
    if (s[i - 1] != s[i]) {
      a.push_back(cnt);
      cnt = 0;
    }
    cnt++;
  }
  a.push_back(cnt);
  if (s[n - 1] == '#') a.push_back(0);
  for (int i = 0; i < a.size(); i += 2) {
    ans += min(a[i], a[i + 1]);
  }
  cout << ans << endl;
  for (int i = 0; i < a.size(); i++) cout << a[i] << endl;
}
