#include <bits/stdc++.h>
using namespace std;
int main() {
  char ch[400010];
  scanf("%s", ch);
  int len = strlen(ch), l = len, ans = 1, maxx = 1;
  for (int i = 0; i < len; i++) {
    ch[i + len] = ch[i];
  }
  len = strlen(ch);
  for (int i = 1; i < len; i++) {
    if (ch[i] != ch[i - 1]) {
      maxx++;
      ans = max(ans, maxx);
    } else {
      maxx = 1;
    }
  }
  ans = min(ans, l);
  cout << ans << endl;
  return 0;
}
