#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  S = S + S;
  long long N = S.size();
  long long a = 1;
  long long res = 1;
  for (long long i = 1; i < N; i++) {
    if (S[i] != S[i - 1]) {
      a++;
      res = max(res, a);
    } else {
      a = 1;
    }
  }
  cout << min(res, N / 2) << endl;
}
