#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
vector<int> dp(1000010);
int main() {
  string S;
  cin >> S;
  int N = S.size();
  cout << N << endl;
  int numO = 0;
  int numZ = 0;
  int numQ = -1;
  int max;
  for (int i = 0; i < N; i++) {
    if (S[i] == '1') {
      numQ = -1;
      numO++;
      numZ = 0;
      chmax(max, numO);
    } else if (S[i] == '0') {
      numQ = -1;
      numO = 0;
      numZ++;
      chmax(max, numZ);
    } else {
      numQ++;
      numO = 0;
      numZ = 0;
      chmax(max, numQ);
    }
  }
  cout << max << endl;
}
