#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int M = 1e5 + 5;
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
const double pi = acos(-1.0);
const int INF = 0x3f3f3f3f;
const long long lINF = 0x3f3f3f3f3f3f3f3fLL;
const int sINF = 0xcfcfcfcf;
char s[M * 2], s1[M];
int mx, tmp, len;
int main() {
  scanf("%s", s1);
  len = strlen(s1);
  mx = tmp = 1;
  strcpy(s, s1);
  strcat(s + len, s1);
  for (int i = 1; i < len * 2; i++) {
    if (s[i] == s[i - 1]) {
      mx = max(mx, tmp);
      tmp = 1;
    } else {
      tmp++;
      mx = max(mx, tmp);
    }
  }
  mx = min(mx, len);
  printf("%d\n", mx);
}
