#include <bits/stdc++.h>
using namespace std;
int n;
char ch[200010];
int main() {
  int i, ans, cnt;
  scanf("%s", ch);
  n = strlen(ch);
  for (i = 0; i < n; i++) ch[n + i] = ch[i];
  ans = 0, cnt = 0;
  for (i = 0; i < 2 * n; i++) {
    if (ch[i] != ch[i - 1])
      cnt++;
    else
      cnt = 1;
    ans = max(ans, min(cnt, n));
  }
  printf("%d\n", ans);
  return 0;
}
