#include <bits/stdc++.h>
char zebra[100005];
int max;
int main() {
  scanf("%s", zebra + 1);
  max = 0;
  int n = strlen(zebra + 1);
  int t = 0;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int k = 1;
    while (zebra[i] != zebra[i + 1] && i + 1 <= n) {
      k++;
      i++;
    }
    if (i == n && t == 0) {
      if (zebra[i] != zebra[1]) {
        k++;
        t++;
        i = 1;
      }
    }
    while (zebra[i] != zebra[i + 1] && i + 1 <= n) {
      k++;
      i++;
    }
    if (k > n) k = n;
    if (k > ans) ans = k;
  }
  printf("%d\n", ans);
  return 0;
}
