#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000;
int n, ans;
char s[maxn + 5];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; i++) s[n + i] = s[i];
  n <<= 1;
  for (int i = 1, now = 0; i <= n; i++)
    s[i - 1] == s[i] ? now = 1 : now++, ans = max(ans, now);
  return printf("%d\n", min(ans, n >> 1)), 0;
}
