#include <bits/stdc++.h>
using namespace std;
struct Ch {
  char c;
  int n;
};
inline bool cmp(Ch c1, Ch c2) { return c1.n > c2.n; }
int main() {
  string s;
  cin >> s;
  vector<Ch> v;
  int n = 1;
  int m = (int)s.size();
  for (int i = 1; i < m; i++) {
    if (s[i] == s[i - 1])
      n++;
    else {
      Ch ch;
      ch.c = s[i - 1];
      if (n % 2 == 0)
        ch.n = n / 2;
      else
        ch.n = n / 2 + 1;
      v.push_back(ch);
      n = 1;
    }
  }
  Ch ch;
  ch.c = s[m - 1];
  if (n % 2 == 0)
    ch.n = n / 2;
  else
    ch.n = n / 2 + 1;
  v.push_back(ch);
  if (v.size() == 1)
    cout << 0;
  else {
    sort(v.begin(), v.end(), cmp);
    int i = 1;
    while (v[i].c == v[0].c) i++;
    cout << v[i].n;
  }
  return 0;
}
