#include <bits/stdc++.h>
using namespace std;
char A[1 << 20];
int f(int n) {
  int i;
  for (i = (0); i < (n); ++i) A[i + n] = A[i];
  int res = 1;
  int cur = 1;
  for (i = (1); i < (n + n); ++i) {
    if (A[i] == A[i - 1]) cur = 0;
    ++cur;
    res = max(res, cur);
  }
  return min(n, res);
}
int main() {
  scanf("%s", A);
  int n = strlen(A);
  int res = f(n);
  reverse(A + 1, A + n);
  res = max(res, f(n));
  printf("%d\n", res);
  return 0;
};
