#include <bits/stdc++.h>
using namespace std;
int n, i, L, l;
char a[200002];
int main() {
  cin >> a;
  n = strlen(a);
  for (i = 0; i < n; ++i) a[n + i] = a[i];
  if (n == 1) {
    cout << 1;
    return 0;
  }
  n *= 2;
  L = 1;
  l = 0;
  for (i = 1; i < n; ++i) {
    if (a[i] != a[i - 1])
      ++l;
    else {
      L = max(L, l + 1);
      l = 0;
    }
  }
  cout << min(max(L, l + 1), n / 2);
}
