#include <bits/stdc++.h>
using namespace std;
int main() {
  string s = "0";
  string x;
  cin >> x;
  s = s + x + x;
  int ans = 0;
  int temp = 0;
  for (int i = 1; i < s.size(); i++) {
    (s[i] != s[i - 1]) ? temp++ : temp = 1;
    ans = max(ans, temp);
  }
  int len = x.size();
  cout << min(len, ans) << endl;
  return 0;
}
