#include <bits/stdc++.h>
using namespace std;
int modpow(int x, int n) {
  if (!n) return 1 % 1000000007;
  int u = modpow(x, n / 2);
  u = (u * u) % 1000000007;
  if (n % 2) u = (u * x) % 1000000007;
  return u;
}
int inv(int x) { return modpow(x, 1000000007 - 2); }
vector<long long> prime;
void seive(long long n) {
  bool prim[n + 1];
  memset(prim, (true), sizeof prim);
  for (long long i = 2; i <= n; i++) {
    if (prim[i]) {
      prime.push_back(i);
      for (long long j = i * 2; j <= n; j += i) {
        prim[j] = false;
      }
    }
  }
}
float area(int x0, int y0, int x1, int y1, int x2, int y2) {
  return float(abs(x0 * (y1 - y2) + x1 * (y2 - y0) + x2 * (y0 - y1))) / 2;
}
int gcd(int a, int b) {
  if (b % a == 0) return a;
  if (!a || !b) return a | b;
  return gcd(b % a, a);
}
int main() {
  string s;
  cin >> s;
  s = s + s;
  long long ans = 1, tt = 1;
  long long len = s.length();
  for (long long i = 1, _b = (len - 1); i <= _b; i++) {
    if (s[i] != s[i - 1])
      tt++;
    else {
      ans = max(ans, tt);
      tt = 1;
    }
  }
  ans = max(ans, tt);
  if (ans == len)
    cout << ans / 2;
  else
    cout << ans;
  return 0;
}
