#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t, i, j, k, l, r, n, m, ans, sum, mx, mn, cnt;
  t = 1;
  string s;
  while (t--) {
    cin >> s;
    string temp = "";
    i = 0;
    while (i < s.size() - 1) {
      if (s[i] == '?' && s[i + 1] == '?') {
        while (i < s.size() - 1 && s[i] == '?') {
          temp += s[i];
          i++;
        }
      }
      if (i > 0 && s[i - 1] != '?' && s[i] == '?' && s[i + 1] != '?')
        i++;
      else
        temp += s[i];
      i++;
    }
    if (s[i] != '?') temp += s[i];
    cout << temp << "\n";
    char y = 'x';
    sum = mx = 0;
    for (i = 0; i < temp.size(); i++) {
      if (temp[i] != '?' && temp[i] != y) {
        sum = 1;
        y = temp[i];
      } else if (temp[i] == '?') {
        y = 'x';
        sum = 0;
      } else if (y == temp[i])
        sum++;
      mx = max(mx, sum);
      cout << sum << " ";
    }
    cout << mx << "\n";
  }
  return 0;
}
