#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  s += s;
  int count = 1;
  int maxc = 1;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] != s[i + 1])
      count++;
    else {
      maxc = max(maxc, count);
      count = 1;
    }
  }
  maxc = max(maxc, count);
  if (maxc > n) maxc -= n;
  cout << maxc;
  return 0;
}
