#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 60;
int t[30];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  int n = s.length();
  char last = s[0];
  int cnt = 0;
  bool f = 1;
  s += "#";
  for (int(i) = (0); (i) < (n + 1); (i)++) {
    if (s[i] == last) cnt++;
    if (s[i] != last) {
      if (!f && i != n) cnt = (cnt + 1) / 2;
      f = 0;
      t[last - 'a'] = max(t[last - 'a'], cnt);
      last = s[i];
      cnt = 1;
    }
  }
  int m = 0, mm = 0;
  for (int(i) = (0); (i) < (26); (i)++) {
    if (t[i] >= m) {
      mm = m;
      m = t[i];
    } else if (t[i] >= mm)
      mm = t[i];
  }
  cout << mm << "\n";
}
