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