#include <bits/stdc++.h>
using namespace std;
long long getLen(long long n);
int main() {
  string str;
  cin >> str;
  long long max = 0;
  char last = '\0';
  long long lastlen = 0;
  bool flag = false;
  int chain = 0;
  for (char c : str) {
    if (c == last) {
      lastlen++;
    } else {
      last = c;
      if (lastlen % 3 == 2) {
        if (chain == 2) {
          max += 1;
          flag = false;
        } else if (flag) {
          max += 1;
          flag = false;
        } else {
          flag = true;
        }
      } else {
        if (flag) {
          chain = 1;
        } else if (chain == 1 && lastlen % 3 == 0) {
          chain = 2;
        } else {
          chain = 0;
        }
        flag = false;
      }
      cout << lastlen << " ";
      ;
      max += getLen(lastlen);
      lastlen = 1;
    }
  }
  if (lastlen % 3 == 2 && flag) {
    max += 1;
  }
  cout << lastlen << " ";
  ;
  cout << endl;
  max += getLen(lastlen);
  cout << max << endl;
}
long long getLen(long long n) { return (n / 3) * 2 + (n % 3 == 0 ? 0 : 1); }
