#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma ma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long gcd(long long a, long long b) {
  long long r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
signed main() {
  string s;
  cin >> s;
  s += s;
  long long k = 1;
  long long ans = 1;
  for (long long i = 1; i < s.size(); ++i) {
    if (s[i] == s[i - 1]) {
      ans = max(ans, k);
      k = 1;
    } else {
      k++;
    }
  }
  ans = max(ans, k);
  if (ans > s.size() / 2) {
    cout << s.size() / 2;
  } else {
    cout << ans;
  }
}
