#include <bits/stdc++.h>
using namespace std;
long long n;
long long tab[250007];
int32_t main() {
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  n = s.size();
  string mm = s + s;
  long long maxi = 1;
  tab[0] = 1;
  for (long long i = 1; i < n * 2; ++i) {
    long long old = min(tab[i - 1], n - 1);
    if (mm[i - 1] != mm[i]) {
      tab[i] = 1 + old;
    } else {
      tab[i] = 1;
    }
    maxi = max(maxi, tab[i]);
  }
  cout << maxi << "\n";
}
