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