#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const long long INF = 1e18;
const int MAX = 100001;
void solve() {
  string str;
  cin >> str;
  str += str;
  long long ans = 0, l = 0;
  for (int i = 1; i < (str.length()); i++) {
    if (str[i - 1] == str[i]) l = i;
    ans = max(ans, i - l + 1);
  }
  cout << min(ans, (long long)str.length() / 2);
}
int main() {
  long long t;
  t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
