#include <bits/stdc++.h>
using namespace std;
string S;
int prefix[2000006];
int main() {
  int N, i, j, k;
  cin >> S;
  S += S;
  N = S.size();
  prefix[0] = 1;
  int ans = 0;
  for (i = 1; i < N; i++) {
    if (S[i] != S[i - 1])
      prefix[i] = prefix[i - 1] + 1;
    else
      prefix[i] = 1;
    ans = max(ans, prefix[i]);
  }
  ans = min(ans, N / 2);
  printf("%d\n", ans);
  return 0;
}
