#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  int n = s.length();
  int len = 1, t = 1;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == '?' && s[i + 1] == '?')
      len++;
    else {
      if (len > t) {
        t = len;
        len = 1;
      } else
        len = 1;
    }
  }
  cout << t << "\n";
}
