#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int N = 2e5 + 5;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  s += s;
  int n = s.size(), ans = 0;
  for (int i = 0; i < n; i++) {
    int j = i + 1;
    while (j < n && s[j] != s[j - 1]) j++;
    ans = max(ans, j - i);
    i = j - 1;
  }
  cout << min(ans, n / 2);
}
