#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans = 0, pos = 0;
  char lbuf, rbuf;
  int lpos, rpos;
  lpos = 0;
  rpos = 1;
  vector<bool> flg(s.size(), false);
  while (rpos < s.size()) {
    lbuf = s.at(lpos);
    rbuf = s.at(rpos);
    if (lbuf != rbuf) {
      ans += 2;
      flg.at(lpos) = true;
      flg.at(rpos) = true;
      rpos++;
      for (int i = 0; i < s.size(); i++) {
        if (flg.at(i) == false) {
          lpos = i;
          break;
        }
      }
    } else {
      rpos++;
      lpos = rpos - 1;
    }
  }
  for (auto x : flg) cout << x << " ";
  cout << endl;
  cout << ans << endl;
  return 0;
}
