#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int ans = 0;
  cin >> s;
  map<char, int> old[2];
  vector<int> times(s.size(), 0);
  for (int i = 0; i < s.size(); i++) {
    if (old[1 - i % 2].find(s[i]) != old[1 - i % 2].end()) {
      times[i] = times[old[1 - i % 2][s[i]]] + 1;
    } else {
      times[i] = 1;
    }
    old[i % 2][s[i]] = i;
  }
  for (auto i : times) {
    ans = max(ans, i);
  }
  cout << ans << endl;
  return 0;
}
