#include <bits/stdc++.h>
using namespace std;
char ch[100000 + 7];
char str[200000 + 7];
int main() {
  scanf("%s", ch);
  int len = strlen(ch);
  for (int i = 0; i < len; i++) {
    str[i] = ch[i];
    str[i + strlen(ch)] = ch[i];
  }
  int ans = 1, ans_max = 0;
  for (int i = 0; i < strlen(str) - 1; i++) {
    if (str[i] != str[i + 1])
      ans++;
    else
      ans = 1;
    ans_max = max(ans_max, ans);
  }
  ans_max = min(ans_max, len);
  printf("%d\n", ans_max);
}
