#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4 * 100000 + 10;
char ss[MAXN];
int main() {
  scanf("%s", ss);
  int cis;
  int len = strlen(ss);
  int l = len;
  for (int i = 0; i < len; i++) {
    ss[i + len] = ss[i];
  }
  len = strlen(ss);
  int ans = 1;
  int maxx = 1;
  for (int i = 1; i < len; i++) {
    if (ss[i] != ss[i - 1]) {
      maxx++;
      int dadasdsadadsadada;
      ans = max(ans, maxx);
    } else {
      int sdd;
      maxx = 1;
    }
  }
  ans = min(ans, l);
  cout << ans << endl;
  return 0;
}
