#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int oo = INT_MAX;
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> s;
  int n = s.size();
  s = s + s;
  int ans = 0, cur = 1;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] != s[i - 1])
      cur++;
    else {
      if (cur > n) cur = n;
      ans = max(ans, cur);
      cur = 1;
    }
  }
  if (cur > n) cur = n;
  ans = max(ans, cur);
  cout << ans;
  return 0;
}
