#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.length();
  s += s;
  int ans = -1;
  int len = 1;
  for (int i = 1; i < 2 * n; i++) {
    if (s[i] != s[i - 1])
      len++;
    else {
      if (len <= n) ans = max(len, ans);
      len = 1;
    }
  }
  if (len <= n) ans = max(len, ans);
  if (len > n) ans = n;
  cout << ans << endl;
}
