#include <bits/stdc++.h>
using namespace std;
char s[1000050];
int max(int x, int y) { return (x > y) ? x : y; }
int main() {
  scanf("%s", &s);
  int len = strlen(s);
  int cnt = 1, j;
  int result = 1;
  for (int i = len; i < 2 * len; i++) {
    s[i] = s[i - len];
  }
  len = 2 * len;
  for (int i = 0; i < len; i = j) {
    for (j = i + 1; j < len; j++) {
      if (s[j] == s[j - 1]) {
        break;
      }
    }
    result = max(result, j - i);
  }
  if (result > len / 2) {
    result = len / 2;
  }
  printf("%d\n", result);
  return 0;
}
