#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
const int INF = 0x3f3f3f3f;
char s[200005];
int main() {
  memset(s, 0, sizeof(s));
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 0; i < n; i++) {
    s[i + n] = s[i];
  }
  int now = 1;
  int ans = 0;
  for (int i = 1; i < 2 * n; i++) {
    if (s[i] != s[i - 1]) {
      now++;
    } else {
      ans = max(ans, now);
      now = 1;
    }
  }
  ans = max(ans, now);
  if (ans > n) ans = n;
  printf("%d", ans);
  return 0;
}
