#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  int maxcombo = 0;
  int combo = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '?')
      combo++;
    else {
      maxcombo = max(maxcombo, combo);
      combo = 0;
    }
  }
  maxcombo = max(maxcombo, combo);
  cout << maxcombo << endl;
}
