#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXLEN = 100000;
char s[2 * MAXLEN + 1];
int slen;
int dp[2 * MAXLEN];
void run() {
  scanf("%s", s);
  slen = strlen(s);
  for (int i = (0); i < (slen); ++i) s[slen + i] = s[i];
  s[2 * slen] = '\0';
  for (int i = (0); i < (2 * slen); ++i)
    dp[i] = 1 + (i - 1 >= 0 && s[i - 1] != s[i] ? dp[i - 1] : 0);
  int ret = 0;
  for (int i = (0); i < (2 * slen); ++i) ret = max(ret, dp[i]);
  ret = min(ret, slen);
  printf("%d\n", ret);
}
int main() {
  run();
  return 0;
}
